Size: 768
Comment:
|
Size: 8808
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 19: | Line 19: |
{{{ | {{{#!highlight bash |
Line 22: | Line 22: |
# revert add svn revert addedFile |
|
Line 33: | Line 36: |
== Ignore one folder == http://stackoverflow.com/questions/11293539/equivalent-of-gitignore-file-with-subversion C# example: * cd ~/trunkx * svn propset svn:ignore "bin" . == Ignore several files folders == http://sdesmedt.wordpress.com/2006/12/10/how-to-make-subversion-ignore-files-and-folders/ svnignore.txt {{{ obj bin }}} Issue the command to ignore the folders listed inside the file * svn propset svn:ignore -F svnignore.txt . * svn status --no-ignore # see ignored files * svn propedit svn:ignore . # shows ignore list on editor * SVN_EDITOR=nano * svn propedit svn:ignore . # uses nano * svn proplist -v -R # shows all properties recursively Add to ~/.bashrc {{{ # export SVN_EDITOR=vi export SVN_EDITOR=nano }}} == Merge == * cd mergeDestination * svn merge --accept postpone originFolder -r1234:HEAD #postpone to resolve conflicts later * svn status | grep '^C ' # only show files with conflits * svn resolve --accept working filex #accepts that working copy of filex does not have conflicts * svn update --accept postpone # updates working copy and automatically postpones conflict resolution == Diff between branches == * svn diff --summarize http://example/svn/repository/branch1 http://example/svn/repository/branch2 == Commit with message(s) in file == * nano messages.txt * svn commit -F messages.txt --username userx == Files added or modified == {{{ svn status | grep "^A\|^M" }}} == Cherrypicking == * svn diff -c 1234 ~/calc/trunk # see diff for revision 1234 * svn merge -c 1234 ~/calc/trunk # merge revision 1234 == Solve conflict == * svn resolved path/file # mark as solved == Revert working copy == * svn revert --recursive . == Mark script as executable == * svn propset svn:executable on xyz.sh == Search logs by username == * svn log --search username == Get folder without content == * svn ls * svn up "folderx" -N == svnserve == The svnserve program is a lightweight server, capable of speaking to clients over TCP/IP using a custom, stateful protocol. Listens port 3690 http://svnbook.red-bean.com/en/1.7/svn.serverconfig.svnserve.html * mkdir -p /tmp/svnserver * svnserve -d -r /tmp/svnserver * svnadmin create --fs-type fsfs /tmp/svnserver/testrepo * cd /tmp * svn checkout svn://localhost/testrepo * cd testrepo '''/tmp/svnserver/test/conf/passwd''' {{{ [users] harry = 1234 sally = 1234 }}} '''/tmp/svnserver/test/conf/svnserve.conf''' {{{ [general] password-db = passwd [sasl] use-sasl = false }}} {{{#!highlight bash touch a svn add a svn commit a --username harry --password 1234 svn log svn up . svn log svn ls mkdir branch tag trunk svn rm a svn status svn add branch/ tag/ trunk/ svn status svn commit -m "Created branch tag trunk" --username harry --password 1234 }}} {{{#!highlight bash #!/bin/sh mkdir -p /tmp/svnserver/testrepo svnadmin create --fs-type fsfs /tmp/svnserver/testrepo cd /tmp/svnserver/testrepo echo -e "[users]\nharry = 1234\nsally = 1234\n" > conf/passwd echo -e "[general]\npassword-db = passwd\n[sasl]\nuse-sasl = false\n" > conf/svnserve.conf BASE_SVN_REPO=svn://localhost/testrepo CREDENTIALS="--username harry --password 1234" cd /tmp svn checkout $BASE_SVN_REPO cd testrepo mkdir branches tag trunk svn add branches/ tag/ trunk/ svn status svn commit -m "Created branches tag trunk" $CREDENTIALS # Committed revision 1. svn up . BASE=/tmp/testrepo cd $BASE/trunk echo -e "trunk 1" > dummy.txt svn add dummy.txt svn commit -m "Created dummy1.txt in trunk" $CREDENTIALS #Committed revision 2 svn up . svn copy $BASE_SVN_REPO/trunk $BASE_SVN_REPO/branches/feature_branch1 $CREDENTIALS -m "created feature branch1" # Committed revision 3. cd $BASE svn up . cd $BASE/branches/feature_branch1 echo -e "fb1 1" >> dummy.txt svn commit -m "Changed dummy1.txt in feature_branch1" $CREDENTIALS #Committed revision 4 svn up . cd $BASE/trunk echo -e "\ntrunk 2\n" >> dummy.txt svn commit -m "Changed trunk" $CREDENTIALS svn up . # Committed revision 5 # Synch from trunk to feature_branch1 cd $BASE/branches/feature_branch1/ svn up . svn merge $BASE_SVN_REPO/trunk $CREDENTIALS --accept postpone # Conflict discovered in file 'dummy.txt'. postpone vi dummy.txt svn resolve --accept working dummy.txt svn status svn commit -m "synch merge from trunk to feature_branch1" $CREDENTIALS svn up . # Committed revision 6. # create feature branch2 from feature branch1 svn copy $BASE_SVN_REPO/branches/feature_branch1 $BASE_SVN_REPO/branches/feature_branch2 $CREDENTIALS -m "created feature branch2 from feature branch1" # Committed revision 7. svn up . cd $BASE svn up . cd $BASE/branches/feature_branch2/ echo -e "\nfb2 1\n" >> dummy.txt svn commit -m "changed feature branch2" $CREDENTIALS svn up . # Committed revision 8. cd $BASE/branches/feature_branch1 echo -e "\nfb1 2\n" >> dummy.txt svn commit -m "changed feature branch1" $CREDENTIALS svn up . # Committed revision 9 # synch feat_branch2 from feat_branch1 cd $BASE/branches/feature_branch2/ svn up . svn merge $BASE_SVN_REPO/branches/feature_branch1 $CREDENTIALS --accept postpone # Conflict discovered in file 'dummy.txt'. postpone vi dummy.txt svn resolve --accept working dummy.txt svn status svn commit -m "synch merge from feature_branch1 to feature_branch2" $CREDENTIALS svn up . # Committed revision 10. cd $BASE/trunk echo -e "\ntrunk 3\n" >> dummy.txt svn commit -m "Changed trunk" $CREDENTIALS svn up . # Committed revision 11. # synch fb1 with trunk cd $BASE/branches/feature_branch1 svn merge $BASE_SVN_REPO/trunk $CREDENTIALS --accept postpone vi dummy.txt # solve conflicts svn resolve --accept working dummy.txt svn commit -m "synch merge from parent trunk to feature branch1" $CREDENTIALS # Committed revision 12. svn up . cd $BASE/trunk/ svn up . svn merge $BASE_SVN_REPO/branches/feature_branch1 $CREDENTIALS --accept postpone svn status svn commit -m "got changes into trunk from feature branch1 (reintegrate)" $CREDENTIALS # Committed revision 13. # terminate feature branch 1 svn rm $BASE_SVN_REPO/branches/feature_branch1 $CREDENTIALS -m "removed feature branch1" # Committed revision 14. cd $BASE svn up . # add new entry to trunk cd $BASE/trunk echo -e "\ntrunk 4\n" >> dummy.txt svn commit -m "changed trunk" $CREDENTIALS #Committed revision 15 svn up . svn diff $BASE_SVN_REPO/trunk@13 $BASE_SVN_REPO/trunk@15 $CREDENTIALS # added trunk 4 svn diff $BASE_SVN_REPO/trunk@3 $BASE_SVN_REPO/trunk@13 $CREDENTIALS # added fb1 1 , trunk 2 , fb1 2 , trunk 3 # the synch from trunk to feature branch 2 should have .... # trunk1, trunk2, trunk3, trunk4, fb2 1, fb1 1, fb1 2, 7 elements # merge from integrate revision to head of trunk cd $BASE/branches/feat_branch2 svn merge $BASE_SVN_REPO/trunk@13 $BASE_SVN_REPO/trunk@HEAD $CREDENTIALS --accept postpone # has all the elements svn merge $BASE_SVN_REPO/trunk@15 $BASE_SVN_REPO/trunk@15 $CREDENTIALS --accept postpone # only has 5 elements # from fb1 creation to reintegration 13 svn merge $BASE_SVN_REPO/trunk@3 $BASE_SVN_REPO/trunk@13 $CREDENTIALS --accept postpone # has six elements, trunk 4 was added in r15 }}} == Show svn diff side by side == {{{#!highlight bash svn --diff-cmd "diff" --extensions "-y" diff svn --diff-cmd "diff" --extensions "-y -W250" diff | colordiff | less -rS svn --diff-cmd "diff" --extensions "-y -W250 --suppress-common-lines" diff | colordiff | less -rS }}} == Revert commited file to previous revision == {{{ #1234 previous revision svn merge -c -1234 test.py svn commit svn up . }}} == merge with revision range == {{{#!highlight bash cd ~/tmp svn co https://feature_branch cd feature_branch svn merge https://parent_branch -r start:end . --accept=postpone # the range of revisions is ]start,end] so only start+1 is applied until end. }}} |
Subversion
Subversion is an open source version control system
https://subversion.apache.org/
Update
svn update
Commit
svn commit -m 'message' svn protected/* themes/* commit -m 'message'
Add unversioned files
/usr/bin/svnaddunversioned.sh:
- chmod 755 /usr/bin/svnaddunversioned.sh
Branches
http://svnbook.red-bean.com/en/1.7/svn.branchmerge.using.html
svn copy http://svn.example.com/repos/calc/trunk http://svn.example.com/repos/calc/branches/my-calc-branch -m "Creating a private branch of /calc/trunk." svn checkout http://svn.example.com/repos/calc/branches/my-calc-branch my-calc-branch
Ignore one folder
http://stackoverflow.com/questions/11293539/equivalent-of-gitignore-file-with-subversion
C# example:
- cd ~/trunkx
- svn propset svn:ignore "bin" .
Ignore several files folders
http://sdesmedt.wordpress.com/2006/12/10/how-to-make-subversion-ignore-files-and-folders/
svnignore.txt
obj bin
Issue the command to ignore the folders listed inside the file
- svn propset svn:ignore -F svnignore.txt .
- svn status --no-ignore # see ignored files
- svn propedit svn:ignore . # shows ignore list on editor
- SVN_EDITOR=nano
- svn propedit svn:ignore . # uses nano
- svn proplist -v -R # shows all properties recursively
Add to ~/.bashrc
# export SVN_EDITOR=vi export SVN_EDITOR=nano
Merge
- cd mergeDestination
- svn merge --accept postpone originFolder -r1234:HEAD #postpone to resolve conflicts later
- svn status | grep '^C ' # only show files with conflits
- svn resolve --accept working filex #accepts that working copy of filex does not have conflicts
- svn update --accept postpone # updates working copy and automatically postpones conflict resolution
Diff between branches
svn diff --summarize http://example/svn/repository/branch1 http://example/svn/repository/branch2
Commit with message(s) in file
- nano messages.txt
- svn commit -F messages.txt --username userx
Files added or modified
svn status | grep "^A\|^M"
Cherrypicking
- svn diff -c 1234 ~/calc/trunk # see diff for revision 1234
- svn merge -c 1234 ~/calc/trunk # merge revision 1234
Solve conflict
- svn resolved path/file # mark as solved
Revert working copy
- svn revert --recursive .
Mark script as executable
- svn propset svn:executable on xyz.sh
Search logs by username
- svn log --search username
Get folder without content
- svn ls
- svn up "folderx" -N
svnserve
The svnserve program is a lightweight server, capable of speaking to clients over TCP/IP using a custom, stateful protocol. Listens port 3690 http://svnbook.red-bean.com/en/1.7/svn.serverconfig.svnserve.html
- mkdir -p /tmp/svnserver
- svnserve -d -r /tmp/svnserver
- svnadmin create --fs-type fsfs /tmp/svnserver/testrepo
- cd /tmp
- svn checkout svn://localhost/testrepo
- cd testrepo
/tmp/svnserver/test/conf/passwd
[users] harry = 1234 sally = 1234
/tmp/svnserver/test/conf/svnserve.conf
[general] password-db = passwd [sasl] use-sasl = false
1 #!/bin/sh
2 mkdir -p /tmp/svnserver/testrepo
3 svnadmin create --fs-type fsfs /tmp/svnserver/testrepo
4 cd /tmp/svnserver/testrepo
5 echo -e "[users]\nharry = 1234\nsally = 1234\n" > conf/passwd
6 echo -e "[general]\npassword-db = passwd\n[sasl]\nuse-sasl = false\n" > conf/svnserve.conf
7 BASE_SVN_REPO=svn://localhost/testrepo
8 CREDENTIALS="--username harry --password 1234"
9 cd /tmp
10 svn checkout $BASE_SVN_REPO
11 cd testrepo
12 mkdir branches tag trunk
13 svn add branches/ tag/ trunk/
14 svn status
15 svn commit -m "Created branches tag trunk" $CREDENTIALS
16 # Committed revision 1.
17 svn up .
18 BASE=/tmp/testrepo
19 cd $BASE/trunk
20 echo -e "trunk 1" > dummy.txt
21 svn add dummy.txt
22 svn commit -m "Created dummy1.txt in trunk" $CREDENTIALS
23 #Committed revision 2
24 svn up .
25 svn copy $BASE_SVN_REPO/trunk $BASE_SVN_REPO/branches/feature_branch1 $CREDENTIALS -m "created feature branch1"
26 # Committed revision 3.
27 cd $BASE
28 svn up .
29 cd $BASE/branches/feature_branch1
30 echo -e "fb1 1" >> dummy.txt
31 svn commit -m "Changed dummy1.txt in feature_branch1" $CREDENTIALS
32 #Committed revision 4
33 svn up .
34 cd $BASE/trunk
35 echo -e "\ntrunk 2\n" >> dummy.txt
36 svn commit -m "Changed trunk" $CREDENTIALS
37 svn up .
38 # Committed revision 5
39 # Synch from trunk to feature_branch1
40 cd $BASE/branches/feature_branch1/
41 svn up .
42 svn merge $BASE_SVN_REPO/trunk $CREDENTIALS --accept postpone
43 # Conflict discovered in file 'dummy.txt'. postpone
44 vi dummy.txt
45 svn resolve --accept working dummy.txt
46 svn status
47 svn commit -m "synch merge from trunk to feature_branch1" $CREDENTIALS
48 svn up .
49 # Committed revision 6.
50 # create feature branch2 from feature branch1
51 svn copy $BASE_SVN_REPO/branches/feature_branch1 $BASE_SVN_REPO/branches/feature_branch2 $CREDENTIALS -m "created feature branch2 from feature branch1"
52 # Committed revision 7.
53 svn up .
54 cd $BASE
55 svn up .
56 cd $BASE/branches/feature_branch2/
57 echo -e "\nfb2 1\n" >> dummy.txt
58 svn commit -m "changed feature branch2" $CREDENTIALS
59 svn up .
60 # Committed revision 8.
61 cd $BASE/branches/feature_branch1
62 echo -e "\nfb1 2\n" >> dummy.txt
63 svn commit -m "changed feature branch1" $CREDENTIALS
64 svn up .
65 # Committed revision 9
66 # synch feat_branch2 from feat_branch1
67 cd $BASE/branches/feature_branch2/
68 svn up .
69 svn merge $BASE_SVN_REPO/branches/feature_branch1 $CREDENTIALS --accept postpone
70 # Conflict discovered in file 'dummy.txt'. postpone
71 vi dummy.txt
72 svn resolve --accept working dummy.txt
73 svn status
74 svn commit -m "synch merge from feature_branch1 to feature_branch2" $CREDENTIALS
75 svn up .
76 # Committed revision 10.
77 cd $BASE/trunk
78 echo -e "\ntrunk 3\n" >> dummy.txt
79 svn commit -m "Changed trunk" $CREDENTIALS
80 svn up .
81 # Committed revision 11.
82 # synch fb1 with trunk
83 cd $BASE/branches/feature_branch1
84 svn merge $BASE_SVN_REPO/trunk $CREDENTIALS --accept postpone
85 vi dummy.txt # solve conflicts
86 svn resolve --accept working dummy.txt
87 svn commit -m "synch merge from parent trunk to feature branch1" $CREDENTIALS
88 # Committed revision 12.
89 svn up .
90 cd $BASE/trunk/
91 svn up .
92 svn merge $BASE_SVN_REPO/branches/feature_branch1 $CREDENTIALS --accept postpone
93 svn status
94 svn commit -m "got changes into trunk from feature branch1 (reintegrate)" $CREDENTIALS
95 # Committed revision 13.
96 # terminate feature branch 1
97 svn rm $BASE_SVN_REPO/branches/feature_branch1 $CREDENTIALS -m "removed feature branch1"
98 # Committed revision 14.
99 cd $BASE
100 svn up .
101 # add new entry to trunk
102 cd $BASE/trunk
103 echo -e "\ntrunk 4\n" >> dummy.txt
104 svn commit -m "changed trunk" $CREDENTIALS
105 #Committed revision 15
106 svn up .
107
108 svn diff $BASE_SVN_REPO/trunk@13 $BASE_SVN_REPO/trunk@15 $CREDENTIALS
109 # added trunk 4
110 svn diff $BASE_SVN_REPO/trunk@3 $BASE_SVN_REPO/trunk@13 $CREDENTIALS
111 # added fb1 1 , trunk 2 , fb1 2 , trunk 3
112 # the synch from trunk to feature branch 2 should have ....
113 # trunk1, trunk2, trunk3, trunk4, fb2 1, fb1 1, fb1 2, 7 elements
114 # merge from integrate revision to head of trunk
115 cd $BASE/branches/feat_branch2
116 svn merge $BASE_SVN_REPO/trunk@13 $BASE_SVN_REPO/trunk@HEAD $CREDENTIALS --accept postpone
117 # has all the elements
118
119 svn merge $BASE_SVN_REPO/trunk@15 $BASE_SVN_REPO/trunk@15 $CREDENTIALS --accept postpone
120 # only has 5 elements
121
122 # from fb1 creation to reintegration 13
123 svn merge $BASE_SVN_REPO/trunk@3 $BASE_SVN_REPO/trunk@13 $CREDENTIALS --accept postpone
124 # has six elements, trunk 4 was added in r15
125
Show svn diff side by side
Revert commited file to previous revision
#1234 previous revision svn merge -c -1234 test.py svn commit svn up .