- 浏览: 155860 次
- 性别:
- 来自: 上海
-
文章分类
最新评论
-
mengshan007:
material:CHP1\/8\-100\-R8* q 我带 ...
Apache Solr 架设搜索服务器 学习笔记 -
bzlring:
怎么从org json字符串转换为 java对象呢?
Java下的json解析工具 -
adsl123gg2008:
貌似没看懂............
hibernate session 的缓存作用 -
Loulley:
<?xml version="1.0" ...
java生成xml -
pengzheng00:
结果是{"name":"reiz ...
Java下的json解析工具
refrence from : http://www.yolinux.com/TUTORIALS/Subversion.html#COMMAND
Subversion Introduction:
Subversion is a software source code "Change Management" (CM) system for collaborative development. It maintains a history of file and directory versions. The files and directories are checked out of the repository and into your local project work area. This called your "working directory". Changes are made to files in your "working directory". After changes are made to the create the next working version, the files are checked into the Subversion CM repository.
Subversion Commands:
Subversion command summary cheat sheet:
Command Description
--------------------------------------------------------------
svn --help List Subversion commands
svn help command
Also: ? or h Help on given "command"
svn add filename
svn add directory
Add a file or directory to Subversion CM control.
Must also perform: svn ci filename (or svn commit) to upload the file or directory. File will not be available in the repository until a "commit" is performed. If adding a directory, the directory and all of its contents recursively are added. i.e.:
svn ci directory
svn commit directory
svn commit .
svn blame filename
svn blame -r RevisionNumber filename
Also: praise, annotate, ann Show file contents with revisions annotated with author information.
svn cat filename List contents of file under Subversion control.
svn checkout http://node-name/repos/svn/trunk/parentPath/path
This creates:
path/file1
path/file2
...
svn checkout http://node-name/repos/svn/trunk/parentPath .
This creates:
path/file1
path/file2
...
Note the difference a "." makes.
svn checkout file:///repos/svn/trunk/path/
svn co -r 497 http://node-name/repos/svn/trunk/path file-name
Also: svn co https://..., svn://..., and svn+ssh://
MS/Windows: svn co file:///c:/repository/project/trunk
Checkout every file from the path and subdirectories specified below. Creates "working" copy of files and directories.
Checkout a repository.
Use option "-r" to specify a specific revision other than the latest.
The URL "svn://" communicates with an SVN server (port 3690)
The URL "http://" comunicates with the Apache server and module mod_dav_svn (port 80) [more common server]
svn cleanup Cleanup subversion files resulting from escaped processes and crashed.
svn commit filename
svn commit --message "Message goes here." filename
svn commit -m "Message goes here." filename
svn ci filename1 filename2 filename3
svn ci . Check-in (commit) local "working" file, files or directory and contents (recursively) into Subversion repository. Atomic, i.e. all committed or none, no incomplete check-in.
svn copy source destination_clone
Also: svn cp ... Copy file or directory tree. One can copy from one local working copy to another or to repository server URL's. The sources and destinations can be working copies or URLs.
svn copy http://host/repos/project/trunk http://host/repos/project/tags/TagName-1.4.5 -m "Tag Release 1.4.5" Tag a release. Takes a snapshot of the repository and assigns a name. This can be performed at any directory branch.
svn copy . http://host/repos/project/tags/TagName-1.4.5 -m "Tag Release 1.4.5" Tag a release. Takes a snapshot of your local working copy and assigns a name. This can be performed at any directory branch.
svn delete filename
svn delete directory
Also: del, remove or rm
svn rm http://host/repos/project/trunk/file-or-directory Delete file from repository. The UNIX command rm file-name. Must perform a "commit" to update the repository and local working directory with the changes. i.e.:
svn commit .
svn diff filename
svn di filename Show file diffs between SVN repository and your file changes using GNU file diff format. Use GUI diff tools as shown below.
svn diff -r rev1:rev2 filename Show file diffs between specified versions.
Example: svn diff -r 456:459 subfn.cpp
Using GUI diff tool: svn diff -r 457:459 --diff-cmd kdiff3 file-name
svn diff filename > patch-file Generate patch file used by the patch command.
svn export directory Export directory tree to your file system but it will not be a "working directory" under SVN control.
svn export -r Rev-Number http://node-name/path Export directory tree of specified version and create local directory tree and files not under SVN control.
svn import local-directory http://node/repos/svn/trunk/directory Add directory (and files in it recursively) to path in repository specified.
svn info filename Display information about file or directory. (Date modified, author, revision, path in repository.)
Can not specify a URL.
svn list directory
svn list file-name List file or directory of files in repository. Used to browse repository before checkout. If current directory is given (svn list ./), then Subversion will list the repository URL of the current directory.
svn list -r RevisionNumber directory List directory of files in repository in specified revision.
svn lock filename -m "comment as to why its locked or by whom"
(Comment is not required but is often useful) Lock file to grant exclusive access to one and forbid all others. A commit will unlock the file (unless the "--no-unlock" option is used). A lock can be removed with the commands: svn unlock filename, svnlook and the svnadmin comands (i.e. List: svnadmin lslocks and remove: svnadmin rmlocks filename).
svn log filename
svn log .
svn log http://URL/path/file
svn log -v .
svn log -r RevisionNumber http://URL/path/file Show the Subversion log messages for a set of revision(s) and/or file(s) and/or all directory contents in repository.
List verbose. Includes list of all files in change
Shows the file changes associated with revision number.
svn merge http://url/path/branch1 http://url/path/branch2 working-local-dir
svn merge file1@revJ file2@revK
svn merge -r 414:411 http://url/path working-dir
svn merge -r 413:HEAD file-name Merge directory changes into your current working directory or merge a file in Subversion into the file in your working directory. If target is not specified, the identical basename or current directory is assumed. Used to incorporate changes checked in which are not accounted for in your file or to merge branches.
Example using GUI merge tool:
svn diff -r 459:454 --diff-cmd kdiff3 --extensions '-m' file-name
Next, tell subversion that the conflicts have been resolved:
svn resolve file-name
Finally, check-in file: svn ci file-name
or abort changes: svn revert file-name
svn merge --dry-run -r 414:413 http://url/path Test merge. No changes are made to your local working copy but shows Subversion feedback as if merge was performed.
svn merge -r 414:413 http://url/path
svn merge -r 414:413 . Undo changes committed in revision 414.
svn mkdir directory
svn mkdir http://URL/directory Create a new directory under version control.
svn move directory1 directory2
svn mv directory1 directory2
svn mv file-old-name file-new-name Rename or move a file or directory. Moves/renames file/directory in repository and in local work area.
Must perform svn ci file-new-name after the move for changes to to take place in repository.
svn revert filename Undo changes in local work files. Throw away local changes.
svn resolved filename Run this command after resolving merge conflicts. Next "commit" your changes.
svn status
svn status -u
svn status -u .
svn status -uq . Show status of file changes in current directory and recursively in directories below.
Show out of date file info: svn status --show-updates
(equivalent: svn status -u)
-u: Determines status by comparing your local repository with the server repository. Without this option, the status shown will only be the changes you have made in your local repository.
-q: Quiet. Do not print "?: File/directory not under version control" or "!: File/directory missing" extraneous information.
First collumn:
* A: File to be added
* C: Conflicting changes
* D: File to be deleted
* G: File to be merged with updates from server
* M: File has been modified
* R: File to be replaced
* G: File to be merged
* X: Resource is external to repository (svn:externals)
* ?: File/directory not under version control
* !: File/directory missing
* ~: Versioned item obstructed by some item of a different kind.
Second collumn: Modification of properties
* ' ' no modifications. Working copy is up to date.
* 'C' Conflicted
* 'M' Modified
* '*' Local file different than repository. A newer revision exists on the server. Update will result in merge or possible conflict.
Third collumn: Locks
o ' ' not locked
o 'L' locked
o 'S' switched to a branch
svn switch http://server/new-branch
svn switch --relocate http://server/old-path http://server/new-path Switch your local working copy to mirror a new repository branch instead of main trunk or previous branch. Also allows you to point your repository to a new path on the server if the server path changes since you performed a check-out.
svn update
svn update filename
svn update -r458 filename
svn update --ignore-externals ./ Migrate all updates from Subversion repository to your local copy (recusively for all files in the current directory and all below it). If there have been updates to the svn repository since you downloaded the files, subversion will give you the opportunity to merge. Status of files will use the coding as stated above for "status". Files marked with a "C" (conflict) should be merged of reverted. If merged then one can perform a "resolve" and then a "check-in".
If a file name is specified, only that file is updated.
Can also syncronize to a specified revision given by -r.
Use --ignore-externals to avoid the slow processing of externals to a potentially slow distant internet server.
Where RevisionNumber is:
* HEAD: The latest revision in the repository.
* BASE: The "pristine" revision of an item in a working copy. Matches checked out version before any modifications.
* COMMITTED: The last revision in which an item changed before (or at) BASE.
* PREV: The revision just before the last revision in which an item changed. (Technically, COMMITTED - 1.)
Example Session:
(Assumes that the repository has already been created. For Subversion repository creation and Subversion server configuration, see the (YoLinux Subversion and Trac tutorial)
* Checkout: svn checkout http://svnserver/repos/svn/trunk/Project1
* Go to source code directory: cd Project1/src
* Edit files:
o vi file1.cpp
o vi file2.cpp
* Verify and test: make
We are ready to check-in the files into the Subversion repository.
* Check repository and report on new revisions and changes others have checked in: svn status -u .
* After many long hours or days of editing and work, get updates others have made: svn update
U file.h
C file1.cpp
G file2.cpp
? a.out
You will see:
o U: File was updated with a newer version checked-in since your checkout.
o G: Automatically merged with no conflicts.
o C: Not merged due to conflicts. You made changes to the same section of code as the update made by someone else since your checkout.
* For each "conflicted" file there will be three new local files generated by "update":
o file1.cpp.mine (File - post editing)
o file1.cpp.rold (BASE - pre editing)
o file1.cpp.rnew (HEAD - Updated file from repository)
The file file1.cpp still exists but with svn conflict marker strings added in the file.
At this point, a check-in will fail until the merge is resolved.
* Merge options:
o Edit the file file1.cpp
Text markers are placed in the file to show the conflicts between the "HEAD" and "mine" versions.
OR
o tkdiff -conflict file1.cpp
OR
o Use a GUI merge tool: kdiff3 file1.cpp.mine file1.cpp.rnew -o file1.cpp
OR
o Throw out your changes/abort: svn revert file1.cpp
No resolve or check-in necessary if file is reverted.
* Verify and test, again: make
* Notify Subversion that conflicts have been resolved: svn resolved file1.cpp
Note: This also removes the temporary files ".mine" and ".r###".
* Check-in to Subversion repository: svn ci -m "Add comments here" file1.cpp
Subversion Peg revisions:
Peg revisions are used so Subversion can find a previous version of a resource (file or directory) if its' location was different than it is now. Peg revisions are that extra hint Subversion needs to clear up ambiguity.
$ svn command -r OPERATIVE-REV item@PEG-REV
The default peg revision is BASE for working copy items and HEAD for repository URLs. When no operative revision is provided, it defaults to being the same revision as the peg revision.
The PEG-REV is specified if the resource (file/directory) in question use to appear in a directory which is no longer in the same place or no longer exists. The "peg-revision" must be specified so subversion can look at the directory in that revision so it can find the resource.
If a peg revision is specified without an operative revision, then the operative revision is assumed to be the same as the peg revision.
For more see: http://svnbook.red-bean.com/en/1.5/svn.advanced.pegrevs.html
Subversion Properties:
Files under revision control can include Subversion keywords which properties can be set with the "propset" command. Keywords are substituted with the Subversion properties and will not appear in the file until a commit is performed. Other properties are used to modify the behavior of Subversion.
The following properties can be set on entities stored in Subversion:
Property Description
svn:ignore A newline separated list of file patterns to ignore. List of files/directories to be ignored by svn status
svn:keywords Valid RCS style keywords are:
* HeadURL - The URL for the head version of the object.
Also: $URL$
* LastChangedBy - The last person to modify the file.
Also: $Author$
* LastChangedDate - The date/time the object was last modified.
Will appear as: $LastChangedDate: 2005-07-22 22:02:37 -0700 (Fri, 22 Jul 2005) $
Also: $Date$
* LastChangedRevision - Describes the last known revision.
Will appear as: $LastChangedRevision: XXX $ where "XXX" is the revision number.
Also: $Rev$, Revision
* $Id$ - A compressed summary of the previous 4 keywords.
Example RCS style comment Example Output
/* $URL$
$Rev$
$Author$
$Date$
$Id$
*/
/* $URL:http://server/svn/path/file.cpp $
$ Rev:2 $
$ Author:Greg $
$ Date:2006-10-12 14:31:84 -0400 (Thu,12 Oct 2006)$
$ Id:file.cpp 3 2006-10-12 18:31:84Z Greg $
*/
svn:executable Ensure file attribute is executable. Possible values: ON, OFF
Example: svn propset svn:executable ON app.exe
svn:eol-style One of 'native', 'LF', 'CR', 'CRLF'. Specify and maintain specified line ending for text file.
* LF: Unix, Linux, standards based OS, proprietary legacy systems, etc.
* CRLF: DOS and Microsoft OSs
* CR: Response input scripts, etc
Example: find ./ -name "*.h" -exec svn propset svn:eol-style LF {} \;
svn:mime-type The mime type of the file:
* text/html
* text/css
* text/plain
* image/jpeg
* ...
See file /etc/mime.types for a list of mime types.
Examples:
* svn propset svn:mime-type text/plain file.cpp
* svn propset svn:mime-type text/html file.html
Web pages rendered from subversion will display as HTML source rather than as a web page unless this mime type is applied.
svn:needs-lock Prevents conflicts for files which can not be contextually merged. i.e. photos, binaries, object libraries.
svn:externals List of files or directories pointed to. Locate repository where directory specified should be retrieved. The directive propset is not required:
svn propedit svn:externals local-target-dir
local-target-dir http://server/svn/dir-remote
local-target-dir/subdir -r### http://server/svn/dir-remote2
svn update
svn commit
svn propget svn:externals ./
The property applies to the directory. Subversion can not list or web browse svn:externals. Check-out ("co"), "export" and "log" can be performed.
Must set environment variable "EDITOR", "SVN_EDITOR", "VISUAL" or set the Subversion configuration file (~/.subversion/config) attribute editor-cmd. i.e.: export EDITOR=vi
Note: Subversion 1.6 introduces file externals in addition to directory externals. The files however must reside in the same repository. Also, the file must point to a location which exists in your local working directory.
[Potential Pitfall]: Apply svn externals to directories and not files. (version 1.4)
[Potential Pitfall]: If generating a tag (branch), one should assign the revision number to the external link to truly snapshot the repository for that tag. This revision number should be specified in the tagged branch version of the svn external.
[Potential Pitfall]: The revision numbers shown by svn info will reflect the version numbers of the repository in which the files are stored. If the files are imported via an svn external directory, the revision numbers will reflect that of the external repository which the external points to and thus from where the files were imported.
Command Description
svn propdel PropertyName file-name
svn propdel --revprop -r RevisionName http://url/path
Also: pdel, pd Remove property name from files or directories.
Remove properties on file in repository.
svn propedit PropertyName file-name
svn propedit --revprop -r RevisionName http://url/path
Also: pedit, pe Edit property name of files or directories.
Edit properties on file in repository.
svn propget PropertyName file-name
svn propget --revprop -r RevisionName http://url/path
Also: pget, pg Print value of property name of files or directories.
Print properties on file in repository.
svn proplist file-name
svn proplist *
svn proplist --revprop -r RevisionName http://url/path
Also: plist, pl List properties of file, files or directory.
svn propset PROPNAME PropertyValue file-name
svn propset PROPNAME --revprop -r RevisionName PropertyValue http://url/path
svn propset svn:mime-type text/html file-name.dat
Also: pset, ps Set properties of file or directory.
Set mime type for a file in the repository. Must perform a commit to upload changes to the repository.
Set file properties so that "^M"'s are removed upon check-in:
svn propset svn:eol-style LF file-name.txt
See YoLinux Subversion server configuration tutorial: No ctrl-M.
Subversion and Graphical diffs for Linux:
Three types of file differences are covered in this section:
1. Show file differences made since checkout was made. This shows the changes you have made. It is usefull to perform this before an update.
2. Show file differences between two files versions stored in Subversion.
3. Show differences / conflicts, choose and merge. Use our bash script svndiffwrapper which integrates into Subversion's file check-in process.
1) File differences since checkout:
The following scripts will allow you to view the changes you have made since checkout. Use the script before running "svn update" as an update will alter the file with diff chevron (>>>>) markers. After performing a "svn update", use tkdiff, gtkdiff or kdiff3 as described below instead of the scripts:
Use the following bash shell script to use the graphical diff tool "mgdiff" with Subversion.
svndiff:
view source
print?
01 #!/bin/bash
02 # svndiff 1.0
03 # usage: svndiff file
04
05 if [[ ! -d .svn ]]
06 then
07 echo ERROR: You are not working in an SVN directory.
08 exit 1
09 fi
10
11 rev="--revision HEAD"
12
13 if [[ ! -n $1 ]]
14 then
15 echo "Usage: svndiff [option] file"
16 echo "Options:"
17 echo " -h Diff with latest in repository (HEAD) - Default"
18 echo " -b Diff with what you had checked out (BASE)"
19 echo " -c Diff with COMMITTED, the version before BASE"
20 echo " -p Diff with PREV, the version before COMMITTED"
21 echo " -r revnum Diff with specified revision (specify integer)"
22 exit 1
23 fi
24
25 while getopts ":r:hbcp" Option
26 do
27 case $Option in
28 h) rev="--revision HEAD";;
29 b) rev="--revision BASE";;
30 c) rev="--revision COMMITTED";;
31 p) rev="--revision PREV";;
32 r) rev="--revision $OPTARG";;
33 *) echo "Incorrect option specified. Use -h or -b or -r #";;
34 esac
35 done
36 shift $(($OPTIND -1))
37
38 # Define graphical diff tool
39 #
40
41 # The geometry option used by Motif, Tcl and X based programs
42 geometry="-geometry 1280x800+0+0"
43
44 # The following is for Motif diff
45 # -w: ignore white space
46 dif="mgdiff -args -w"
47
48 file=$1
49 prev=${file}_PREV
50
51 # Trap bash command signals
52 # SIGINT 2
53 # SIGQUIT 3
54 # SIGTERM 15
55 trap "rm -f $prev" 2 3 15
56 svn cat $rev $file > $prev 2>/dev/null
57 $dif $geometry $prev $file
58
59 sleep 1
60 rm -f $prev
Compares your current local copy with the latest in the repository (Default "-h").
OR
Use the following bash shell script to use the graphical diff tool "gvimdiff:" with Subversion:
svndiff:
view source
print?
01 #!/bin/bash
02 # usage: svndiff file
03
04 if [[ ! -d .svn ]]
05 then
06 echo ERROR: You are not working in an SVN directory.
07 exit 1
08 fi
09
10 # Define graphical diff tool
11 #
12
13 dif="gvimdiff \"+colo morning\" -R"
14
15 file=$1
16 prev=PREV_${file}
17
18 # Trap bash command signals
19 # SIGINT 2
20 # SIGQUIT 3
21 # SIGTERM 15
22 trap "rm -f $prev" 2 3 15
23 svn cat $file > $prev 2>/dev/null
24 $dif $prev $file
25
26 # Sleep for non-blocking apps like gvimdiff.
27 # Allow gvimdiff to read file before it is deleted.
28 sleep 2
29 rm -f $prev
Compare your current local copy with the original copy you checked out.
2) File differences between two revisions:
This configuration supports the use of GUI diff tools with Subversion by using the command: svn diff -r 457:459 --diff-cmd
Some diff tools are supported with native svn. i.e.: svn diff -r 457:459 --diff-cmd kdiff3 file-name while others require a wrapper script to arrange the arguments correctly.
Subversion configurations and defaults are specified in the file: $HOME/.subversion/config
..
...
[helpers]
editor-cmd = gedit
diff-cmd = /opt/bin/diffScript
diff3-cmd = /opt/bin/diff3Script
...
..
This configuration configures Subversion to execute the script /opt/bin/diffScript to launch your own diff toolwith the command: svn diff -r Old:New URL.
File: /opt/bin/diffScript
view source
print?
01 #!/bin/bash
02
03 LeftLabel=$3
04 RightLabel=$5
05 LeftFile=$6
06 RightFile=$7
07
08 #gtkdiff $LeftFile $RightFile
09 tkdiff $LeftFile $RightFile -L "$LeftLabel" -L "$RightLabel" &
10
11 # wait for command to finish
12 wait
Note: To debug what is passed as a command line argument to the diff tool, set the diff-cmd to "echo":
..
...
[helpers]
diff-cmd = echo
...
..
This configuration echos to the screen the command line arguments being passed to the diff tool when the following command is executed: svn diff .....
i.e. -u -L d0/f01.cpp (revision 1) -L d0/f01.cpp (working copy) d0/.svn/text-base/f01.cpp.svn-base d0/.svn/empty-file
3) Conflicts, file differences and merge:
* tkdiff: Subversion conflict resolution merge: tkdiff -conflict file1.cpp
Select from tkdiff toolbar: "Merge" + "Show Merge Window" to open third results window.
* kdiff3 diff and merge: svn diff -r 457:459 --diff-cmd kdiff3 --extensions '-m' file-name
* svndiffwrapper: Bash script to add options to Merge|Ignore|Accept|Revert etc as a result of a check-in. This script does it all!!
Edit file: $HOME/.subversion/config
...
[helpers]
diff-cmd = svndiffwrapper
diff3-cmd = svndiffwrapper
...
Use our bash script svndiffwrapper to perform this integrated task. By default, uses kdiff3 for diff tool. Can also specify your own choice of diff tool.
Place the script in /opt/bin/ for global use or $HOME/bin/ for private user access and set permissions so that script execution is allowed: chmod ugo+x /opt/bin/svndiffwrapper
List of graphical diff and merge tools:
* tkdiff: [download] Comes with tkcvs Subversion GUI front-end.
Examples of Subversion diffs with tkdiff: (See: tkdiff --help)
o tkdiff old-URL@revA new-URL@revB
o tkdiff -r457 -r459 file-name
Note: Use command "svn log file-name" to view valid revision numbers for the file. Referencing invalid revision numbers as input to tkdiff will not work.
* gtkdiff: Has diff3 and merge features. Written with GTK+. After gtkdiff-0.8.0, GNOME desktop required.
* diffUse: Diff/merge GUI tool. Good line matching features. Supports Unicode.
* kdiff3: Graphical directory and file diff, merge and edit. KDE3/Qt based. Supports drag and drop. Comes with S.u.S.E. distro. (Cross platform) MS/Windows download available. A very good directory and file diff and merge tool.
o Difference: kdiff3 file1 file2
o Difference: kdiff3 file1 file2 file3
o Difference of two files: kdiff3 directory1/file directory2
o Difference: kdiff3 directory1 directory2
o Merge: kdiff3 directory1 directory2 -o dest-directory
o Merge: kdiff3 file1 file2 -m
o Merge: kdiff3 file1 file2 -o output-file
o Diff with SVN: svn diff -r 457:459 --diff-cmd kdiff3 file-name
* Kompare: Ships with (RHEL4/FC3) KDE SDK. [manual]
* mgdiff: [download] Motif-based graphical file difference browser and merge. Comes with S.u.S.E. distro.
* Meld: Compare, edit and merge.
* fldiff: Graphical file and directory diff. (Cross platform)
* xxdiff: Compare 2 or 3 files and merge. Also compares directories.
* gvim and gvimdiff
Subversion GUI interfaces for Linux:
* TkSVN / TkCVS: Tcl/Tk based GUI. A very good Unix/Linux and MS/Windows GUI front-end to Subversion. Simple to install (requires tk). Supports GUI diff/merge, branching, tagging, editing, check-in/check-out, ...
Installation to /usr/local/bin and lib (Add to your path.): (requires RPM: tk version 8.4+)
o tar xzf tkcvs_8_0_3.tar.gz
o cd tkcvs_8_0_3
o ./doinstall.tcl -nox /opt
Configuration: (See: ~/.tkcvs)
Set default editor and diff tool:
...
set cvscfg(editor) "xterm -e vim"
set cvscfg(tkdiff) "tkdiff"
Also see default config file: /opt/lib/tkcvs/tkcvs_def.tcl
Sets default editors for various file types. Set editor to "gedit" for rookies.
If you want to run TkSVN / TkCVS on MS/Windows, download Tk for MS/Windows. It can also be run from the Cygwin environment using Tk provided in the Cygwin shell.
* Tigris.org: RapidSVN: Dependent on wxWidgets cross platform C++ GUI API.
Download RPMs from Dag Wieers:
o rapidsvn-0.7.2-1.2.el4.rf.i386.rpm
o wxGTK-2.4.2-5.2.el4.rf.i386.rpm
* pysvn: Python subversion front-end. (cross platform) [download]
* eSVN: qt based GUI. Mediocre.
* KdeSvn: KDE front-end.
* Subcommander: Subversion GUI client with visual diff and merge tool with support for different text encodings
* Subview: GTK based subversion (1.3+) client.
* JSVN: Java SVN client
* Syncro SVN Client - Commercial product. Editor, diff tool and SVN client in one integrated tool.
Web Clients:
* Kamikaze-qscm: Web based front-end similar to Mozilla Bonsai.
* WebClient for SVN: Implemented in JSP for Tomcat 4
* ViewSVN: PHP4
* Easy SVN: PERL cgi
Plug-ins:
* NaughtySVN: GNOME Nautilus file browser SVN plug-in.
* Ksvn: Subversion client plugin for the KDE Konqueror browser.
* Eclipse plug-ins:
o Tigris.org: subclipse
Also see: C/C++ development environment and Eclipse
o Subversive
Subversion Security Tips:
One should be aware of a possible Subversion client security hole. The Subversion client authentication will cache your login and password in your home directory in non-encrypted clear text. It will have file system security so others can not read the file however, it still is visible by root or by a root user of the file server if one is used for home directories.
Here are three solutions to reduce this potential security vulnerability:
1. Don't allow Subversion to cache the password: svn commit -F file.txt --no-auth-cache
This will request a username and password but will not store it.
2. Set the Subversion configuration file on server to not cache:
[auth]
store-auth-creds = no
3. Delete cached files when you logout. Reduces risk but does not eliminate it. This uses the bash shell logout script to perform a clean-up of the authentication files.
File: ~/.bash_logout
view source
print?
1 rm ~/.subversion/auth/svn.simple/*
Subversion utility commands and scripts:
Command Description
svnversion local-path This svn admin command will produce a compact version number for a working copy. Lists range of versions, adds "S" if switched, "M" modified.
svnchangesince Shows the changes to the subversion repository since the local copy was last updated.
svnlastlog Displays the last log message that pertains to the current working copy. Simplified svnlastchange.
svnlastchange Displays the last log message and a unified diff of the changes made in the last commit.
svn-clean Removes all the files and directories that are not in Subversion.
List of KDE scripts (See scripts which start with "svn")
Report Generation:
Often one will have to generate a report or source list. The following awk script and command will generate a simple source version description report:
File: svd_report.awk
view source
print?
1 BEGIN { RS="";
2 FS = "\n";
3 printf("%-75s %5s %-45s\n","Path","Rev","Last Change Date"); }
4 /^Path:/ { n1 = split($1,path,":");
5 n2 = split($6,revision,":");
6 n3 = split($11,changeDate,": ");
7 printf("%-75s %5s %-45s\n", path[2], revision[2], changeDate[2]); }
Command to generate the report: svn info -R * | awk -f svd_report.awk
The Subversion "info" command will generate a dump of information about all of the files under Subversion control recursively (-R) through all subdirectories. The AWK script will parse the output and generate a simple report. The AWK script views the Subversion output as an AWK record seperated by blank line where the content of each line is deliminated by the ":" (colon).
For more information on AWK scripts, see the awk man page
Subversion Best Practices:
* ALWAYS compile and test before checking in source code. Subversion revisions should correspond to revisions which compile.
* Always add check-in comments. Nothing is more obnoxious that looking at a blank log or information history.
* Monstrous binary files like CD or DVD ISO images are better suited for storage on a file system rather than in Subversion. Subversion will not be able to show differences betwen version and will be slower than a raw filesystem.
* Don't copy, rename and move directories and files with system shell commands. Use Subversion commands to "rm", "mv", and "add" directories and files and then commit changes when done. Work within Subversion.
* Commit changes as a single logical changeset for one purpose. Thus all code changes for a single bug fix or enhancement should be checked-in together. This allows one to better follow the history log of changes.
o Check-in code at the directory level and all changed files, recursively in the directory and subdirectories will be checked in together.
svn ci -m "Check-in comment goes here" ./
o Check-in files together by specifying them explicitly:
svn ci -m "Check-in comment goes here" file.cpp file2.cpp ...
* Tie Bug tracking and Subversion CM together:
o Use comments when checking-in files into Subversion. Add bug tracking numbers to the comments so Subversion will reference Trac bugs.
o If using Trac, add trac comments so that links are generated to the Subversion repository by placing the Subversion revision number in square braces (i.e. [1140]) in a Trac comment. In this way, Trac will have a direct URL link to Subversion.
* If using Trac integrated with Subversion, refer to the Trac ticket in the Subversion check-in comment using a "#" in front of the Trac ticket number (eg. #65) This generates a hyperlink when the Subversion logs are viewed in Trac.
* Taking code from a Subversion repository for upload to another: Use "svn export" and NOT "svn co" if you want files for upload into another CM repository. A checkout (svn co) will create Subversion management directories (.svn/) in the local working copy. You will not want to upload these directories into a CM system as they are only for the user's local working directory only. An "export" will not create these directories.
* The "tags" branches are NOT to be used as working branches but are snapshots of an existing branch. The "tags" are for historical reference such as a release, well tested version or progress milestone.
* Documentation and related artifacts should not be under the source tree but parallel to it. This isolates the source tree so that email notification triggers sent to developers upon source changes will only go out on source changes or regression build and test systems like Cabie will only rebuild and test on source changes rather than on unrelated documentation changes.
Links:
* YoLinux Tutorial: Subversion Server and Trac Server Installation and Configuration
* YoLinux Tutorial: Cabie Build System - Installation and Configuration
* svnbook.red-bean.com: Open Sourced version of O'Reily Book
o Subversion 1.1 - single page
o Subversion 1.1 - multi-page
* Reference card [pdf]
* Subversionary: Subversion advocacy web site.
* Integrating JDeveloper and Subversion
Books:
Version Control with Subversion
by C. Michael Pilato
ISBN #0596004486, O'Reilly Press
Amazon.com
Practical Subversion (Expert's Voice in Open Source)
Garrett Rooney
ISBN #1590592905, Apress
Amazon.com
Subversion Version Control: Using the Subversion Version Control System in Development Projects
William Nagel
ISBN #0131855182, Prentice Hall PTR
Subversion Introduction:
Subversion is a software source code "Change Management" (CM) system for collaborative development. It maintains a history of file and directory versions. The files and directories are checked out of the repository and into your local project work area. This called your "working directory". Changes are made to files in your "working directory". After changes are made to the create the next working version, the files are checked into the Subversion CM repository.
Subversion Commands:
Subversion command summary cheat sheet:
Command Description
--------------------------------------------------------------
svn --help List Subversion commands
svn help command
Also: ? or h Help on given "command"
svn add filename
svn add directory
Add a file or directory to Subversion CM control.
Must also perform: svn ci filename (or svn commit) to upload the file or directory. File will not be available in the repository until a "commit" is performed. If adding a directory, the directory and all of its contents recursively are added. i.e.:
svn ci directory
svn commit directory
svn commit .
svn blame filename
svn blame -r RevisionNumber filename
Also: praise, annotate, ann Show file contents with revisions annotated with author information.
svn cat filename List contents of file under Subversion control.
svn checkout http://node-name/repos/svn/trunk/parentPath/path
This creates:
path/file1
path/file2
...
svn checkout http://node-name/repos/svn/trunk/parentPath .
This creates:
path/file1
path/file2
...
Note the difference a "." makes.
svn checkout file:///repos/svn/trunk/path/
svn co -r 497 http://node-name/repos/svn/trunk/path file-name
Also: svn co https://..., svn://..., and svn+ssh://
MS/Windows: svn co file:///c:/repository/project/trunk
Checkout every file from the path and subdirectories specified below. Creates "working" copy of files and directories.
Checkout a repository.
Use option "-r" to specify a specific revision other than the latest.
The URL "svn://" communicates with an SVN server (port 3690)
The URL "http://" comunicates with the Apache server and module mod_dav_svn (port 80) [more common server]
svn cleanup Cleanup subversion files resulting from escaped processes and crashed.
svn commit filename
svn commit --message "Message goes here." filename
svn commit -m "Message goes here." filename
svn ci filename1 filename2 filename3
svn ci . Check-in (commit) local "working" file, files or directory and contents (recursively) into Subversion repository. Atomic, i.e. all committed or none, no incomplete check-in.
svn copy source destination_clone
Also: svn cp ... Copy file or directory tree. One can copy from one local working copy to another or to repository server URL's. The sources and destinations can be working copies or URLs.
svn copy http://host/repos/project/trunk http://host/repos/project/tags/TagName-1.4.5 -m "Tag Release 1.4.5" Tag a release. Takes a snapshot of the repository and assigns a name. This can be performed at any directory branch.
svn copy . http://host/repos/project/tags/TagName-1.4.5 -m "Tag Release 1.4.5" Tag a release. Takes a snapshot of your local working copy and assigns a name. This can be performed at any directory branch.
svn delete filename
svn delete directory
Also: del, remove or rm
svn rm http://host/repos/project/trunk/file-or-directory Delete file from repository. The UNIX command rm file-name. Must perform a "commit" to update the repository and local working directory with the changes. i.e.:
svn commit .
svn diff filename
svn di filename Show file diffs between SVN repository and your file changes using GNU file diff format. Use GUI diff tools as shown below.
svn diff -r rev1:rev2 filename Show file diffs between specified versions.
Example: svn diff -r 456:459 subfn.cpp
Using GUI diff tool: svn diff -r 457:459 --diff-cmd kdiff3 file-name
svn diff filename > patch-file Generate patch file used by the patch command.
svn export directory Export directory tree to your file system but it will not be a "working directory" under SVN control.
svn export -r Rev-Number http://node-name/path Export directory tree of specified version and create local directory tree and files not under SVN control.
svn import local-directory http://node/repos/svn/trunk/directory Add directory (and files in it recursively) to path in repository specified.
svn info filename Display information about file or directory. (Date modified, author, revision, path in repository.)
Can not specify a URL.
svn list directory
svn list file-name List file or directory of files in repository. Used to browse repository before checkout. If current directory is given (svn list ./), then Subversion will list the repository URL of the current directory.
svn list -r RevisionNumber directory List directory of files in repository in specified revision.
svn lock filename -m "comment as to why its locked or by whom"
(Comment is not required but is often useful) Lock file to grant exclusive access to one and forbid all others. A commit will unlock the file (unless the "--no-unlock" option is used). A lock can be removed with the commands: svn unlock filename, svnlook and the svnadmin comands (i.e. List: svnadmin lslocks and remove: svnadmin rmlocks filename).
svn log filename
svn log .
svn log http://URL/path/file
svn log -v .
svn log -r RevisionNumber http://URL/path/file Show the Subversion log messages for a set of revision(s) and/or file(s) and/or all directory contents in repository.
List verbose. Includes list of all files in change
Shows the file changes associated with revision number.
svn merge http://url/path/branch1 http://url/path/branch2 working-local-dir
svn merge file1@revJ file2@revK
svn merge -r 414:411 http://url/path working-dir
svn merge -r 413:HEAD file-name Merge directory changes into your current working directory or merge a file in Subversion into the file in your working directory. If target is not specified, the identical basename or current directory is assumed. Used to incorporate changes checked in which are not accounted for in your file or to merge branches.
Example using GUI merge tool:
svn diff -r 459:454 --diff-cmd kdiff3 --extensions '-m' file-name
Next, tell subversion that the conflicts have been resolved:
svn resolve file-name
Finally, check-in file: svn ci file-name
or abort changes: svn revert file-name
svn merge --dry-run -r 414:413 http://url/path Test merge. No changes are made to your local working copy but shows Subversion feedback as if merge was performed.
svn merge -r 414:413 http://url/path
svn merge -r 414:413 . Undo changes committed in revision 414.
svn mkdir directory
svn mkdir http://URL/directory Create a new directory under version control.
svn move directory1 directory2
svn mv directory1 directory2
svn mv file-old-name file-new-name Rename or move a file or directory. Moves/renames file/directory in repository and in local work area.
Must perform svn ci file-new-name after the move for changes to to take place in repository.
svn revert filename Undo changes in local work files. Throw away local changes.
svn resolved filename Run this command after resolving merge conflicts. Next "commit" your changes.
svn status
svn status -u
svn status -u .
svn status -uq . Show status of file changes in current directory and recursively in directories below.
Show out of date file info: svn status --show-updates
(equivalent: svn status -u)
-u: Determines status by comparing your local repository with the server repository. Without this option, the status shown will only be the changes you have made in your local repository.
-q: Quiet. Do not print "?: File/directory not under version control" or "!: File/directory missing" extraneous information.
First collumn:
* A: File to be added
* C: Conflicting changes
* D: File to be deleted
* G: File to be merged with updates from server
* M: File has been modified
* R: File to be replaced
* G: File to be merged
* X: Resource is external to repository (svn:externals)
* ?: File/directory not under version control
* !: File/directory missing
* ~: Versioned item obstructed by some item of a different kind.
Second collumn: Modification of properties
* ' ' no modifications. Working copy is up to date.
* 'C' Conflicted
* 'M' Modified
* '*' Local file different than repository. A newer revision exists on the server. Update will result in merge or possible conflict.
Third collumn: Locks
o ' ' not locked
o 'L' locked
o 'S' switched to a branch
svn switch http://server/new-branch
svn switch --relocate http://server/old-path http://server/new-path Switch your local working copy to mirror a new repository branch instead of main trunk or previous branch. Also allows you to point your repository to a new path on the server if the server path changes since you performed a check-out.
svn update
svn update filename
svn update -r458 filename
svn update --ignore-externals ./ Migrate all updates from Subversion repository to your local copy (recusively for all files in the current directory and all below it). If there have been updates to the svn repository since you downloaded the files, subversion will give you the opportunity to merge. Status of files will use the coding as stated above for "status". Files marked with a "C" (conflict) should be merged of reverted. If merged then one can perform a "resolve" and then a "check-in".
If a file name is specified, only that file is updated.
Can also syncronize to a specified revision given by -r.
Use --ignore-externals to avoid the slow processing of externals to a potentially slow distant internet server.
Where RevisionNumber is:
* HEAD: The latest revision in the repository.
* BASE: The "pristine" revision of an item in a working copy. Matches checked out version before any modifications.
* COMMITTED: The last revision in which an item changed before (or at) BASE.
* PREV: The revision just before the last revision in which an item changed. (Technically, COMMITTED - 1.)
Example Session:
(Assumes that the repository has already been created. For Subversion repository creation and Subversion server configuration, see the (YoLinux Subversion and Trac tutorial)
* Checkout: svn checkout http://svnserver/repos/svn/trunk/Project1
* Go to source code directory: cd Project1/src
* Edit files:
o vi file1.cpp
o vi file2.cpp
* Verify and test: make
We are ready to check-in the files into the Subversion repository.
* Check repository and report on new revisions and changes others have checked in: svn status -u .
* After many long hours or days of editing and work, get updates others have made: svn update
U file.h
C file1.cpp
G file2.cpp
? a.out
You will see:
o U: File was updated with a newer version checked-in since your checkout.
o G: Automatically merged with no conflicts.
o C: Not merged due to conflicts. You made changes to the same section of code as the update made by someone else since your checkout.
* For each "conflicted" file there will be three new local files generated by "update":
o file1.cpp.mine (File - post editing)
o file1.cpp.rold (BASE - pre editing)
o file1.cpp.rnew (HEAD - Updated file from repository)
The file file1.cpp still exists but with svn conflict marker strings added in the file.
At this point, a check-in will fail until the merge is resolved.
* Merge options:
o Edit the file file1.cpp
Text markers are placed in the file to show the conflicts between the "HEAD" and "mine" versions.
OR
o tkdiff -conflict file1.cpp
OR
o Use a GUI merge tool: kdiff3 file1.cpp.mine file1.cpp.rnew -o file1.cpp
OR
o Throw out your changes/abort: svn revert file1.cpp
No resolve or check-in necessary if file is reverted.
* Verify and test, again: make
* Notify Subversion that conflicts have been resolved: svn resolved file1.cpp
Note: This also removes the temporary files ".mine" and ".r###".
* Check-in to Subversion repository: svn ci -m "Add comments here" file1.cpp
Subversion Peg revisions:
Peg revisions are used so Subversion can find a previous version of a resource (file or directory) if its' location was different than it is now. Peg revisions are that extra hint Subversion needs to clear up ambiguity.
$ svn command -r OPERATIVE-REV item@PEG-REV
The default peg revision is BASE for working copy items and HEAD for repository URLs. When no operative revision is provided, it defaults to being the same revision as the peg revision.
The PEG-REV is specified if the resource (file/directory) in question use to appear in a directory which is no longer in the same place or no longer exists. The "peg-revision" must be specified so subversion can look at the directory in that revision so it can find the resource.
If a peg revision is specified without an operative revision, then the operative revision is assumed to be the same as the peg revision.
For more see: http://svnbook.red-bean.com/en/1.5/svn.advanced.pegrevs.html
Subversion Properties:
Files under revision control can include Subversion keywords which properties can be set with the "propset" command. Keywords are substituted with the Subversion properties and will not appear in the file until a commit is performed. Other properties are used to modify the behavior of Subversion.
The following properties can be set on entities stored in Subversion:
Property Description
svn:ignore A newline separated list of file patterns to ignore. List of files/directories to be ignored by svn status
svn:keywords Valid RCS style keywords are:
* HeadURL - The URL for the head version of the object.
Also: $URL$
* LastChangedBy - The last person to modify the file.
Also: $Author$
* LastChangedDate - The date/time the object was last modified.
Will appear as: $LastChangedDate: 2005-07-22 22:02:37 -0700 (Fri, 22 Jul 2005) $
Also: $Date$
* LastChangedRevision - Describes the last known revision.
Will appear as: $LastChangedRevision: XXX $ where "XXX" is the revision number.
Also: $Rev$, Revision
* $Id$ - A compressed summary of the previous 4 keywords.
Example RCS style comment Example Output
/* $URL$
$Rev$
$Author$
$Date$
$Id$
*/
/* $URL:http://server/svn/path/file.cpp $
$ Rev:2 $
$ Author:Greg $
$ Date:2006-10-12 14:31:84 -0400 (Thu,12 Oct 2006)$
$ Id:file.cpp 3 2006-10-12 18:31:84Z Greg $
*/
svn:executable Ensure file attribute is executable. Possible values: ON, OFF
Example: svn propset svn:executable ON app.exe
svn:eol-style One of 'native', 'LF', 'CR', 'CRLF'. Specify and maintain specified line ending for text file.
* LF: Unix, Linux, standards based OS, proprietary legacy systems, etc.
* CRLF: DOS and Microsoft OSs
* CR: Response input scripts, etc
Example: find ./ -name "*.h" -exec svn propset svn:eol-style LF {} \;
svn:mime-type The mime type of the file:
* text/html
* text/css
* text/plain
* image/jpeg
* ...
See file /etc/mime.types for a list of mime types.
Examples:
* svn propset svn:mime-type text/plain file.cpp
* svn propset svn:mime-type text/html file.html
Web pages rendered from subversion will display as HTML source rather than as a web page unless this mime type is applied.
svn:needs-lock Prevents conflicts for files which can not be contextually merged. i.e. photos, binaries, object libraries.
svn:externals List of files or directories pointed to. Locate repository where directory specified should be retrieved. The directive propset is not required:
svn propedit svn:externals local-target-dir
local-target-dir http://server/svn/dir-remote
local-target-dir/subdir -r### http://server/svn/dir-remote2
svn update
svn commit
svn propget svn:externals ./
The property applies to the directory. Subversion can not list or web browse svn:externals. Check-out ("co"), "export" and "log" can be performed.
Must set environment variable "EDITOR", "SVN_EDITOR", "VISUAL" or set the Subversion configuration file (~/.subversion/config) attribute editor-cmd. i.e.: export EDITOR=vi
Note: Subversion 1.6 introduces file externals in addition to directory externals. The files however must reside in the same repository. Also, the file must point to a location which exists in your local working directory.
[Potential Pitfall]: Apply svn externals to directories and not files. (version 1.4)
[Potential Pitfall]: If generating a tag (branch), one should assign the revision number to the external link to truly snapshot the repository for that tag. This revision number should be specified in the tagged branch version of the svn external.
[Potential Pitfall]: The revision numbers shown by svn info will reflect the version numbers of the repository in which the files are stored. If the files are imported via an svn external directory, the revision numbers will reflect that of the external repository which the external points to and thus from where the files were imported.
Command Description
svn propdel PropertyName file-name
svn propdel --revprop -r RevisionName http://url/path
Also: pdel, pd Remove property name from files or directories.
Remove properties on file in repository.
svn propedit PropertyName file-name
svn propedit --revprop -r RevisionName http://url/path
Also: pedit, pe Edit property name of files or directories.
Edit properties on file in repository.
svn propget PropertyName file-name
svn propget --revprop -r RevisionName http://url/path
Also: pget, pg Print value of property name of files or directories.
Print properties on file in repository.
svn proplist file-name
svn proplist *
svn proplist --revprop -r RevisionName http://url/path
Also: plist, pl List properties of file, files or directory.
svn propset PROPNAME PropertyValue file-name
svn propset PROPNAME --revprop -r RevisionName PropertyValue http://url/path
svn propset svn:mime-type text/html file-name.dat
Also: pset, ps Set properties of file or directory.
Set mime type for a file in the repository. Must perform a commit to upload changes to the repository.
Set file properties so that "^M"'s are removed upon check-in:
svn propset svn:eol-style LF file-name.txt
See YoLinux Subversion server configuration tutorial: No ctrl-M.
Subversion and Graphical diffs for Linux:
Three types of file differences are covered in this section:
1. Show file differences made since checkout was made. This shows the changes you have made. It is usefull to perform this before an update.
2. Show file differences between two files versions stored in Subversion.
3. Show differences / conflicts, choose and merge. Use our bash script svndiffwrapper which integrates into Subversion's file check-in process.
1) File differences since checkout:
The following scripts will allow you to view the changes you have made since checkout. Use the script before running "svn update" as an update will alter the file with diff chevron (>>>>) markers. After performing a "svn update", use tkdiff, gtkdiff or kdiff3 as described below instead of the scripts:
Use the following bash shell script to use the graphical diff tool "mgdiff" with Subversion.
svndiff:
view source
print?
01 #!/bin/bash
02 # svndiff 1.0
03 # usage: svndiff file
04
05 if [[ ! -d .svn ]]
06 then
07 echo ERROR: You are not working in an SVN directory.
08 exit 1
09 fi
10
11 rev="--revision HEAD"
12
13 if [[ ! -n $1 ]]
14 then
15 echo "Usage: svndiff [option] file"
16 echo "Options:"
17 echo " -h Diff with latest in repository (HEAD) - Default"
18 echo " -b Diff with what you had checked out (BASE)"
19 echo " -c Diff with COMMITTED, the version before BASE"
20 echo " -p Diff with PREV, the version before COMMITTED"
21 echo " -r revnum Diff with specified revision (specify integer)"
22 exit 1
23 fi
24
25 while getopts ":r:hbcp" Option
26 do
27 case $Option in
28 h) rev="--revision HEAD";;
29 b) rev="--revision BASE";;
30 c) rev="--revision COMMITTED";;
31 p) rev="--revision PREV";;
32 r) rev="--revision $OPTARG";;
33 *) echo "Incorrect option specified. Use -h or -b or -r #";;
34 esac
35 done
36 shift $(($OPTIND -1))
37
38 # Define graphical diff tool
39 #
40
41 # The geometry option used by Motif, Tcl and X based programs
42 geometry="-geometry 1280x800+0+0"
43
44 # The following is for Motif diff
45 # -w: ignore white space
46 dif="mgdiff -args -w"
47
48 file=$1
49 prev=${file}_PREV
50
51 # Trap bash command signals
52 # SIGINT 2
53 # SIGQUIT 3
54 # SIGTERM 15
55 trap "rm -f $prev" 2 3 15
56 svn cat $rev $file > $prev 2>/dev/null
57 $dif $geometry $prev $file
58
59 sleep 1
60 rm -f $prev
Compares your current local copy with the latest in the repository (Default "-h").
OR
Use the following bash shell script to use the graphical diff tool "gvimdiff:" with Subversion:
svndiff:
view source
print?
01 #!/bin/bash
02 # usage: svndiff file
03
04 if [[ ! -d .svn ]]
05 then
06 echo ERROR: You are not working in an SVN directory.
07 exit 1
08 fi
09
10 # Define graphical diff tool
11 #
12
13 dif="gvimdiff \"+colo morning\" -R"
14
15 file=$1
16 prev=PREV_${file}
17
18 # Trap bash command signals
19 # SIGINT 2
20 # SIGQUIT 3
21 # SIGTERM 15
22 trap "rm -f $prev" 2 3 15
23 svn cat $file > $prev 2>/dev/null
24 $dif $prev $file
25
26 # Sleep for non-blocking apps like gvimdiff.
27 # Allow gvimdiff to read file before it is deleted.
28 sleep 2
29 rm -f $prev
Compare your current local copy with the original copy you checked out.
2) File differences between two revisions:
This configuration supports the use of GUI diff tools with Subversion by using the command: svn diff -r 457:459 --diff-cmd
Some diff tools are supported with native svn. i.e.: svn diff -r 457:459 --diff-cmd kdiff3 file-name while others require a wrapper script to arrange the arguments correctly.
Subversion configurations and defaults are specified in the file: $HOME/.subversion/config
..
...
[helpers]
editor-cmd = gedit
diff-cmd = /opt/bin/diffScript
diff3-cmd = /opt/bin/diff3Script
...
..
This configuration configures Subversion to execute the script /opt/bin/diffScript to launch your own diff toolwith the command: svn diff -r Old:New URL.
File: /opt/bin/diffScript
view source
print?
01 #!/bin/bash
02
03 LeftLabel=$3
04 RightLabel=$5
05 LeftFile=$6
06 RightFile=$7
07
08 #gtkdiff $LeftFile $RightFile
09 tkdiff $LeftFile $RightFile -L "$LeftLabel" -L "$RightLabel" &
10
11 # wait for command to finish
12 wait
Note: To debug what is passed as a command line argument to the diff tool, set the diff-cmd to "echo":
..
...
[helpers]
diff-cmd = echo
...
..
This configuration echos to the screen the command line arguments being passed to the diff tool when the following command is executed: svn diff .....
i.e. -u -L d0/f01.cpp (revision 1) -L d0/f01.cpp (working copy) d0/.svn/text-base/f01.cpp.svn-base d0/.svn/empty-file
3) Conflicts, file differences and merge:
* tkdiff: Subversion conflict resolution merge: tkdiff -conflict file1.cpp
Select from tkdiff toolbar: "Merge" + "Show Merge Window" to open third results window.
* kdiff3 diff and merge: svn diff -r 457:459 --diff-cmd kdiff3 --extensions '-m' file-name
* svndiffwrapper: Bash script to add options to Merge|Ignore|Accept|Revert etc as a result of a check-in. This script does it all!!
Edit file: $HOME/.subversion/config
...
[helpers]
diff-cmd = svndiffwrapper
diff3-cmd = svndiffwrapper
...
Use our bash script svndiffwrapper to perform this integrated task. By default, uses kdiff3 for diff tool. Can also specify your own choice of diff tool.
Place the script in /opt/bin/ for global use or $HOME/bin/ for private user access and set permissions so that script execution is allowed: chmod ugo+x /opt/bin/svndiffwrapper
List of graphical diff and merge tools:
* tkdiff: [download] Comes with tkcvs Subversion GUI front-end.
Examples of Subversion diffs with tkdiff: (See: tkdiff --help)
o tkdiff old-URL@revA new-URL@revB
o tkdiff -r457 -r459 file-name
Note: Use command "svn log file-name" to view valid revision numbers for the file. Referencing invalid revision numbers as input to tkdiff will not work.
* gtkdiff: Has diff3 and merge features. Written with GTK+. After gtkdiff-0.8.0, GNOME desktop required.
* diffUse: Diff/merge GUI tool. Good line matching features. Supports Unicode.
* kdiff3: Graphical directory and file diff, merge and edit. KDE3/Qt based. Supports drag and drop. Comes with S.u.S.E. distro. (Cross platform) MS/Windows download available. A very good directory and file diff and merge tool.
o Difference: kdiff3 file1 file2
o Difference: kdiff3 file1 file2 file3
o Difference of two files: kdiff3 directory1/file directory2
o Difference: kdiff3 directory1 directory2
o Merge: kdiff3 directory1 directory2 -o dest-directory
o Merge: kdiff3 file1 file2 -m
o Merge: kdiff3 file1 file2 -o output-file
o Diff with SVN: svn diff -r 457:459 --diff-cmd kdiff3 file-name
* Kompare: Ships with (RHEL4/FC3) KDE SDK. [manual]
* mgdiff: [download] Motif-based graphical file difference browser and merge. Comes with S.u.S.E. distro.
* Meld: Compare, edit and merge.
* fldiff: Graphical file and directory diff. (Cross platform)
* xxdiff: Compare 2 or 3 files and merge. Also compares directories.
* gvim and gvimdiff
Subversion GUI interfaces for Linux:
* TkSVN / TkCVS: Tcl/Tk based GUI. A very good Unix/Linux and MS/Windows GUI front-end to Subversion. Simple to install (requires tk). Supports GUI diff/merge, branching, tagging, editing, check-in/check-out, ...
Installation to /usr/local/bin and lib (Add to your path.): (requires RPM: tk version 8.4+)
o tar xzf tkcvs_8_0_3.tar.gz
o cd tkcvs_8_0_3
o ./doinstall.tcl -nox /opt
Configuration: (See: ~/.tkcvs)
Set default editor and diff tool:
...
set cvscfg(editor) "xterm -e vim"
set cvscfg(tkdiff) "tkdiff"
Also see default config file: /opt/lib/tkcvs/tkcvs_def.tcl
Sets default editors for various file types. Set editor to "gedit" for rookies.
If you want to run TkSVN / TkCVS on MS/Windows, download Tk for MS/Windows. It can also be run from the Cygwin environment using Tk provided in the Cygwin shell.
* Tigris.org: RapidSVN: Dependent on wxWidgets cross platform C++ GUI API.
Download RPMs from Dag Wieers:
o rapidsvn-0.7.2-1.2.el4.rf.i386.rpm
o wxGTK-2.4.2-5.2.el4.rf.i386.rpm
* pysvn: Python subversion front-end. (cross platform) [download]
* eSVN: qt based GUI. Mediocre.
* KdeSvn: KDE front-end.
* Subcommander: Subversion GUI client with visual diff and merge tool with support for different text encodings
* Subview: GTK based subversion (1.3+) client.
* JSVN: Java SVN client
* Syncro SVN Client - Commercial product. Editor, diff tool and SVN client in one integrated tool.
Web Clients:
* Kamikaze-qscm: Web based front-end similar to Mozilla Bonsai.
* WebClient for SVN: Implemented in JSP for Tomcat 4
* ViewSVN: PHP4
* Easy SVN: PERL cgi
Plug-ins:
* NaughtySVN: GNOME Nautilus file browser SVN plug-in.
* Ksvn: Subversion client plugin for the KDE Konqueror browser.
* Eclipse plug-ins:
o Tigris.org: subclipse
Also see: C/C++ development environment and Eclipse
o Subversive
Subversion Security Tips:
One should be aware of a possible Subversion client security hole. The Subversion client authentication will cache your login and password in your home directory in non-encrypted clear text. It will have file system security so others can not read the file however, it still is visible by root or by a root user of the file server if one is used for home directories.
Here are three solutions to reduce this potential security vulnerability:
1. Don't allow Subversion to cache the password: svn commit -F file.txt --no-auth-cache
This will request a username and password but will not store it.
2. Set the Subversion configuration file on server to not cache:
[auth]
store-auth-creds = no
3. Delete cached files when you logout. Reduces risk but does not eliminate it. This uses the bash shell logout script to perform a clean-up of the authentication files.
File: ~/.bash_logout
view source
print?
1 rm ~/.subversion/auth/svn.simple/*
Subversion utility commands and scripts:
Command Description
svnversion local-path This svn admin command will produce a compact version number for a working copy. Lists range of versions, adds "S" if switched, "M" modified.
svnchangesince Shows the changes to the subversion repository since the local copy was last updated.
svnlastlog Displays the last log message that pertains to the current working copy. Simplified svnlastchange.
svnlastchange Displays the last log message and a unified diff of the changes made in the last commit.
svn-clean Removes all the files and directories that are not in Subversion.
List of KDE scripts (See scripts which start with "svn")
Report Generation:
Often one will have to generate a report or source list. The following awk script and command will generate a simple source version description report:
File: svd_report.awk
view source
print?
1 BEGIN { RS="";
2 FS = "\n";
3 printf("%-75s %5s %-45s\n","Path","Rev","Last Change Date"); }
4 /^Path:/ { n1 = split($1,path,":");
5 n2 = split($6,revision,":");
6 n3 = split($11,changeDate,": ");
7 printf("%-75s %5s %-45s\n", path[2], revision[2], changeDate[2]); }
Command to generate the report: svn info -R * | awk -f svd_report.awk
The Subversion "info" command will generate a dump of information about all of the files under Subversion control recursively (-R) through all subdirectories. The AWK script will parse the output and generate a simple report. The AWK script views the Subversion output as an AWK record seperated by blank line where the content of each line is deliminated by the ":" (colon).
For more information on AWK scripts, see the awk man page
Subversion Best Practices:
* ALWAYS compile and test before checking in source code. Subversion revisions should correspond to revisions which compile.
* Always add check-in comments. Nothing is more obnoxious that looking at a blank log or information history.
* Monstrous binary files like CD or DVD ISO images are better suited for storage on a file system rather than in Subversion. Subversion will not be able to show differences betwen version and will be slower than a raw filesystem.
* Don't copy, rename and move directories and files with system shell commands. Use Subversion commands to "rm", "mv", and "add" directories and files and then commit changes when done. Work within Subversion.
* Commit changes as a single logical changeset for one purpose. Thus all code changes for a single bug fix or enhancement should be checked-in together. This allows one to better follow the history log of changes.
o Check-in code at the directory level and all changed files, recursively in the directory and subdirectories will be checked in together.
svn ci -m "Check-in comment goes here" ./
o Check-in files together by specifying them explicitly:
svn ci -m "Check-in comment goes here" file.cpp file2.cpp ...
* Tie Bug tracking and Subversion CM together:
o Use comments when checking-in files into Subversion. Add bug tracking numbers to the comments so Subversion will reference Trac bugs.
o If using Trac, add trac comments so that links are generated to the Subversion repository by placing the Subversion revision number in square braces (i.e. [1140]) in a Trac comment. In this way, Trac will have a direct URL link to Subversion.
* If using Trac integrated with Subversion, refer to the Trac ticket in the Subversion check-in comment using a "#" in front of the Trac ticket number (eg. #65) This generates a hyperlink when the Subversion logs are viewed in Trac.
* Taking code from a Subversion repository for upload to another: Use "svn export" and NOT "svn co" if you want files for upload into another CM repository. A checkout (svn co) will create Subversion management directories (.svn/) in the local working copy. You will not want to upload these directories into a CM system as they are only for the user's local working directory only. An "export" will not create these directories.
* The "tags" branches are NOT to be used as working branches but are snapshots of an existing branch. The "tags" are for historical reference such as a release, well tested version or progress milestone.
* Documentation and related artifacts should not be under the source tree but parallel to it. This isolates the source tree so that email notification triggers sent to developers upon source changes will only go out on source changes or regression build and test systems like Cabie will only rebuild and test on source changes rather than on unrelated documentation changes.
Links:
* YoLinux Tutorial: Subversion Server and Trac Server Installation and Configuration
* YoLinux Tutorial: Cabie Build System - Installation and Configuration
* svnbook.red-bean.com: Open Sourced version of O'Reily Book
o Subversion 1.1 - single page
o Subversion 1.1 - multi-page
* Reference card [pdf]
* Subversionary: Subversion advocacy web site.
* Integrating JDeveloper and Subversion
Books:
Version Control with Subversion
by C. Michael Pilato
ISBN #0596004486, O'Reilly Press
Amazon.com
Practical Subversion (Expert's Voice in Open Source)
Garrett Rooney
ISBN #1590592905, Apress
Amazon.com
Subversion Version Control: Using the Subversion Version Control System in Development Projects
William Nagel
ISBN #0131855182, Prentice Hall PTR
发表评论
-
【原】shell 收集
2011-04-12 19:08 1033【基础shell语法】 时间差 ... -
【转】apache加载php时出错报undefined symbol: sqlite3ExprDelete
2010-11-22 08:16 2060运行apache服务时,出错: httpd: Syntax ... -
【原】Linux shell 定时打包备份脚本
2010-11-18 23:00 5699花二个小时学习了一下 shell 脚本, 做一个定时备份程序, ... -
【转】linux 打包压缩命令
2010-11-09 13:56 917tar命令 [root@linux ~]# tar [-c ... -
Linux 不能上网解决办法
2010-09-16 22:49 1027From : http://mintelong.iteye.c ...
相关推荐
少儿编程scratch项目源代码文件案例素材-方形跑步者.zip
文档支持目录章节跳转同时还支持阅读器左侧大纲显示和章节快速定位,文档内容完整、条理清晰。文档内所有文字、图表、函数、目录等元素均显示正常,无任何异常情况,敬请您放心查阅与使用。文档仅供学习参考,请勿用作商业用途。 Rust 以内存安全、零成本抽象和并发高效的特性,重塑编程体验。无需垃圾回收,却能通过所有权与借用检查机制杜绝空指针、数据竞争等隐患。从底层系统开发到 Web 服务构建,从物联网设备到高性能区块链,它凭借出色的性能和可靠性,成为开发者的全能利器。拥抱 Rust,解锁高效、安全编程新境界!
文档支持目录章节跳转同时还支持阅读器左侧大纲显示和章节快速定位,文档内容完整、条理清晰。文档内所有文字、图表、函数、目录等元素均显示正常,无任何异常情况,敬请您放心查阅与使用。文档仅供学习参考,请勿用作商业用途。 Rust 以内存安全、零成本抽象和并发高效的特性,重塑编程体验。无需垃圾回收,却能通过所有权与借用检查机制杜绝空指针、数据竞争等隐患。从底层系统开发到 Web 服务构建,从物联网设备到高性能区块链,它凭借出色的性能和可靠性,成为开发者的全能利器。拥抱 Rust,解锁高效、安全编程新境界!
内容概要:本文详细介绍了三菱PLC 5u与台达变频器通过Modbus RTU协议进行通讯的全过程。涵盖了硬件接线方法,确保RS-485接口正确连接;变频器参数设置,包括通讯地址、波特率、数据格式等关键参数的调整;PLC程序编写,利用Modbus RTU功能块实现数据读写;以及威纶通触摸屏程序配置,提供友好的人机交互界面。每一步骤均配有详尽解释和实例代码,确保实施过程顺畅。 适合人群:从事工业自动化领域的工程师和技术人员,尤其是对PLC和变频器通讯有一定了解的基础用户。 使用场景及目标:适用于需要将三菱PLC 5u与台达变频器集成到同一系统中的工程项目,旨在建立稳定的通讯链路,实现高效的数据交换和远程控制。通过本文的学习,可以掌握完整的通讯解决方案,提高系统的可靠性和可控性。 其他说明:文中提供了丰富的调试技巧和常见问题解决方法,如通讯超时排查、CRC校验注意事项等,有助于快速定位并解决问题。同时附带了完整的程序包和接线图,便于实际应用。
内容概要:本文详细介绍了双向全桥CLLC拓扑的双闭环控制系统设计及其MATLAB/Simulink仿真。首先解析了CLLC拓扑结构,重点讨论了谐振腔参数(Lr、Cr、Lm)的选择和计算方法。接着阐述了双闭环控制策略,即电压外环确保稳态精度,电流内环应对动态扰动,并提供了具体的PI控制器实现代码。文中还强调了磁性元件选型的重要性,特别是变压器设计中的注意事项。最后,通过仿真验证系统的动态响应性能,展示了负载突增时的恢复时间和软开关效果。同时,作者分享了许多实用的调试技巧和避坑经验。 适合人群:从事电力电子设计的技术人员,尤其是对双向DC-DC变换器感兴趣的工程师。 使用场景及目标:适用于需要高效双向能量传输的应用场合,如储能系统、电动汽车充电设备等。目标是帮助读者掌握CLLC拓扑的设计原理和控制方法,提高系统效率和稳定性。 其他说明:文章不仅提供了详细的理论推导和公式计算,还附带了完整的MATLAB/Simulink仿真文件,便于读者进行实践操作。此外,作者针对常见问题给出了具体的解决方案,使读者能够更快地理解和应用相关技术。
内容概要:本文详细介绍了轮毂电机分布式驱动电动汽车的直接横摆力矩控制(DYC)技术及其在Matlab/Simulink中的实现。首先构建了一个7自由度的整车模型,涵盖了车身横摆、侧倾、垂跳以及四个车轮的独立旋转,确保模型能够精确模拟真实车辆行为。轮胎模型采用了魔术公式进行参数化,确保不同路况下的抓地力计算准确性。上层控制器选择了模糊PID控制,通过规则库实现了对不同驾驶情况的智能响应,特别是在横摆角速度误差较大时切换为滑模控制,提高了系统的鲁棒性和稳定性。扭矩分配方面,采用了平均分配策略并加入了动态限幅机制,确保各电机在不同工况下的高效协同工作。联合控制策略融合了横摆角速度跟踪和质心侧偏角控制,通过自适应权重系数优化了车辆的整体操控性能。 适合人群:汽车工程专业学生、自动驾驶及电动汽车领域的研究人员和技术人员。 使用场景及目标:适用于研究和开发轮毂电机分布式驱动电动汽车的操稳性控制系统,旨在提高车辆在各种复杂路况下的稳定性和安全性。 其他说明:文中提供了大量具体的代码片段和实验数据,帮助读者更好地理解和应用所介绍的技术方案。同时强调了理论与实际相结合的重要性,指出了在实车验证过程中需要注意的关键点。
少儿编程scratch项目源代码文件案例素材-愤怒的小鸟太空版黄金版.zip
内容概要:本文详细介绍了如何使用MATLAB和YALMIP工具包构建一个微网优化调度模型。该模型涵盖了光伏发电、风力发电、柴油发电机和蓄电池储能四种主要发电单元。通过引入CPLEX求解器,实现了对不同发电单元的最优调度,旨在最小化发电成本并确保系统稳定性。文中不仅提供了详细的代码示例,还解释了各个组件的工作原理及其相互之间的协调方式。此外,文章讨论了如何处理风光出力的不确定性和柴油机组的启停成本等问题,展示了完整的优化求解过程。 适合人群:对电力系统优化调度感兴趣的初学者,尤其是那些希望深入了解MATLAB、YALMIP和CPLEX在微网调度中应用的研究人员和技术人员。 使用场景及目标:适用于研究和教学环境,帮助读者理解微网调度的基本原理和方法。具体目标包括:① 学习如何在MATLAB中使用YALMIP进行优化建模;② 掌握风光柴储四类发电单元的特性及其在微网中的角色;③ 实现最小化发电成本的目标函数,并确保系统稳定运行。 其他说明:文章提供了丰富的代码片段和图表,便于读者理解和实践。同时,作者指出了一些常见错误和注意事项,如单位一致性、充放电效率处理等,有助于提高模型的可靠性和准确性。
内容概要:本文详细介绍了使用MATLAB 2014版进行16QAM调制信号在AWGN信道下的误码率(BER)和误比特率(SER)性能仿真的方法。首先配置基础参数如调制阶数、符号数和信噪比范围,然后通过生成随机数据并应用格雷码映射进行调制。接着利用awgn函数加入噪声,并通过qamdemod函数解调。性能评估方面,采用biterr和symerr函数分别计算误比特率和误符号率,并与理论公式得出的结果进行对比。文中还分享了一些常见错误及优化建议,如确保信号功率归一化、正确转换EbNo到SNR以及使用足够的符号数来提高仿真准确性。 适合人群:通信工程专业学生、从事无线通信研究的技术人员、希望深入理解数字调制技术的科研工作者。 使用场景及目标:①学习16QAM调制原理及其在AWGN信道中的表现;②掌握MATLAB环境下进行通信系统仿真的具体步骤和技术要点;③通过实践加深对误码率、信噪比等概念的理解。 其他说明:文中提供了完整的代码片段供读者参考,并强调了多个容易忽视的关键点,帮助初学者避开常见的陷阱。此外,还提到了一些扩展方向,如尝试不同类型的信道或更高的调制阶数。
少儿编程scratch项目源代码文件案例素材-疯狂啤酒花.zip
FireFox-whatruns-1.7.7.xpi
少儿编程scratch项目源代码文件案例素材-动画 VS 动画:第一部分.zip
内容概要:本文详细介绍了台达PLC (DVP15MC) 伺服追剪系统的实现过程,涵盖电子凸轮配置、追剪触发逻辑、伺服参数设置以及触摸屏界面设计等方面。文章首先讲解了电子凸轮参数配置的具体方法,如使用CAM_BOX_CFG指令进行凸轮表设置,并强调了凸轮曲线数据的预处理方式。接着深入探讨了追剪触发逻辑,展示了如何通过MC_GearInPos指令实现伺服轴的相位同步,确保切割动作的精确执行。此外,文章还涉及了触摸屏界面设计,包括实时显示伺服位置和设定位置的方法,以及如何通过HMI进行动态补偿。最后,作者分享了一些调试经验和优化技巧,如电子齿轮比的计算、伺服参数的优化以及如何利用MC_Plot工具进行运动曲线分析。 适合人群:从事自动化控制系统开发的技术人员,尤其是熟悉台达PLC和伺服系统的工程师。 使用场景及目标:适用于需要实现高精度伺服追剪控制的工业应用场景,如包装机械、食品加工等领域。主要目标是帮助工程师理解和掌握台达PLC伺服追剪系统的具体实现方法和技术要点,提高系统的稳定性和精度。 其他说明:文中提供了完整的源代码和详细的调试建议,有助于读者快速上手并应用于实际项目中。同时,文中提到的一些实用技巧和注意事项对于避免常见错误非常有帮助。
五一数学建模
内容概要:本文详细介绍了DSP28335与FPGA之间的150MHz并行通信技术及其在PWM外扩中的应用。首先讨论了DSP28335的XINTF总线配置方法,包括区域选择、数据准备和建立保持时间的设置。接着阐述了FPGA端的硬件描述语言实现,如内存映射接收模块的设计,确保数据传输的准确性与时效性。文中还探讨了双向传输的关键点,即总线控制权的切换机制,并提供了具体的代码示例。此外,针对PWM扩展部分,展示了如何利用FPGA构建高效的PWM发生器阵列,从而满足多电机控制系统的需求。最后强调了调试过程中应注意的问题,如时序约束、跨时钟域处理等。 适合人群:从事嵌入式系统开发的技术人员,尤其是那些需要进行高速数据传输和复杂外设扩展工作的工程师。 使用场景及目标:① 实现DSP28335与FPGA间的高效并行通信;② 解决因DSP自带PWM通道不足而带来的限制;③ 提供一种灵活且高性能的PWM扩展解决方案,适用于多电机控制和其他实时性强的应用场景。 其他说明:文章不仅提供了详细的理论讲解和技术细节,还分享了许多实战经验和常见问题的解决方案,帮助开发者更好地理解和掌握相关技术。
内容概要:本文详细介绍了使用无迹卡尔man滤波(UKF)构建四轮轮毂电机驱动车辆的故障诊断模型。该模型利用Matlab/Simulink平台搭建了一个7自由度的整车模型,涵盖了车辆的纵向、侧向、横摆运动以及四个轮子的旋转自由度。通过引入UKF算法,能够实时监控四个电机的健康状态(0或1),并在电机发生故障时迅速做出反应。文中展示了如何通过正弦转向输入制造非线性工况,以检验状态估计器的效果,并讨论了UKF模块的具体实现,包括状态预测、更新步骤以及观测方程的设计。此外,还分享了一些调试经验和常见问题的解决方案。 适合人群:从事自动驾驶、电动汽车研究的技术人员,尤其是对故障诊断和状态估计感兴趣的工程师。 使用场景及目标:适用于四轮轮毂电机驱动车辆的研发和测试环节,旨在提高车辆的安全性和可靠性,确保在电机故障情况下能够及时准确地识别并采取相应措施。 其他说明:文中提到的关键技术和实现细节对于理解和应用UKF算法具有重要参考价值,同时也为后续的研究提供了宝贵的经验和技术支持。
内容概要:本文详细介绍了基于GD32F1XX系列MCU的全功能FOC(磁场定向控制)电机控制系统的开发过程及其核心技术。主要内容涵盖FOC算法的具体实现步骤,包括Clarke变换、Park变换、PI调节、逆Park变换和SVM调制等;防飞车功能的设计,确保启动安全性;与铁塔王设备通信的协议解析,提高通信效率;以及针对不同国产32位芯片的移植方法。此外,文中还探讨了油门信号处理、EABS电子刹车控制、硬件架构设计等方面的技术细节,并提供了完整的源代码和硬件设计文件供开发者参考。 适合人群:具有一定嵌入式开发经验,特别是对电机控制感兴趣的工程师和技术爱好者。 使用场景及目标:适用于电动两轮车、三轮车及其他小型电动车的控制器开发。主要目标是帮助开发者理解和掌握FOC控制技术,同时提供一个经过实战验证的开源项目作为参考。 其他说明:该项目不仅包含了详细的代码注释和硬件设计资料,还分享了许多实用的经验技巧,如滑动滤波算法的应用、PWM调制的注意事项等。对于希望深入了解工业级电机控制系统的读者来说,这是一个非常有价值的资源。
文档支持目录章节跳转同时还支持阅读器左侧大纲显示和章节快速定位,文档内容完整、条理清晰。文档内所有文字、图表、函数、目录等元素均显示正常,无任何异常情况,敬请您放心查阅与使用。文档仅供学习参考,请勿用作商业用途。 编译闪电般迅速,并发性能卓越,部署轻松简单!Go 语言以极简设计理念和出色工程性能,成为云原生时代的首选编程语言。从 Docker 到 Kubernetes,全球顶尖科技企业都在采用 Go。点击了解 Go 语言的核心优势、实战窍门和未来走向,开启高效编程的全新体验!
内容概要:本文详细介绍了如何利用LabVIEW进行电子秤的485 Modbus通讯开发,涵盖硬件准备、串口配置、Modbus RTU协议帧构造、CRC校验、数据解析以及参数设定等方面的内容。文中提供了具体的代码示例,如串口配置、命令帧构建、CRC校验生成、数据类型转换等,并分享了作者在实际项目中遇到的问题及其解决方案,如字节序处理、超时设置、错误处理等。 适合人群:从事自动化控制系统开发的技术人员,尤其是对LabVIEW和Modbus通讯有一定了解并希望深入掌握相关技能的研发人员。 使用场景及目标:适用于需要将电子秤集成到自动化控制系统中的工程项目,旨在帮助开发者快速搭建稳定的电子秤通讯系统,确保能够可靠地读取重量数据和设定参数。 其他说明:文章强调了在实际应用中需要注意的一些细节和技术要点,如硬件接线、波特率设置、寄存器地址映射等,同时提供了一些调试技巧和性能优化建议,有助于提高系统的稳定性和可靠性。
少儿编程scratch项目源代码文件案例素材-方块爆炸 v1.1.zip