Size: 8508
Comment:
|
Size: 8774
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 285: | Line 285: |
== 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 svnadmin create --fs-type fsfs /tmp/svnserver/testrepo
3 cd /tmp/svnserver/testrepo
4 echo -e "[users]\nharry = 1234\nsally = 1234\n" > conf/passwd
5 echo -e "[general]\npassword-db = passwd\n[sasl]\nuse-sasl = false\n" > conf/svnserve.conf
6 BASE_SVN_REPO=svn://localhost/testrepo
7 CREDENTIALS="--username harry --password 1234"
8 cd /tmp
9 svn checkout $BASE_SVN_REPO
10 cd testrepo
11 mkdir branches tag trunk
12 svn add branches/ tag/ trunk/
13 svn status
14 svn commit -m "Created branches tag trunk" $CREDENTIALS
15 # Committed revision 1.
16 svn up .
17 BASE=/tmp/testrepo
18 cd $BASE/trunk
19 echo -e "trunk 1" > dummy.txt
20 svn add dummy.txt
21 svn commit -m "Created dummy1.txt in trunk" $CREDENTIALS
22 #Committed revision 2
23 svn up .
24 svn copy $BASE_SVN_REPO/trunk $BASE_SVN_REPO/branches/feature_branch1 $CREDENTIALS -m "created feature branch1"
25 # Committed revision 3.
26 cd $BASE
27 svn up .
28 cd $BASE/branches/feature_branch1
29 echo -e "fb1 1" >> dummy.txt
30 svn commit -m "Changed dummy1.txt in feature_branch1" $CREDENTIALS
31 #Committed revision 4
32 svn up .
33 cd $BASE/trunk
34 echo -e "\ntrunk 2\n" >> dummy.txt
35 svn commit -m "Changed trunk" $CREDENTIALS
36 svn up .
37 # Committed revision 5
38 # Synch from trunk to feature_branch1
39 cd $BASE/branches/feature_branch1/
40 svn up .
41 svn merge $BASE_SVN_REPO/trunk $CREDENTIALS --accept postpone
42 # Conflict discovered in file 'dummy.txt'. postpone
43 vi dummy.txt
44 svn resolve --accept working dummy.txt
45 svn status
46 svn commit -m "synch merge from trunk to feature_branch1" $CREDENTIALS
47 svn up .
48 # Committed revision 6.
49 # create feature branch2 from feature branch1
50 svn copy $BASE_SVN_REPO/branches/feature_branch1 $BASE_SVN_REPO/branches/feature_branch2 $CREDENTIALS -m "created feature branch2 from feature branch1"
51 # Committed revision 7.
52 svn up .
53 cd $BASE
54 svn up .
55 cd $BASE/branches/feature_branch2/
56 echo -e "\nfb2 1\n" >> dummy.txt
57 svn commit -m "changed feature branch2" $CREDENTIALS
58 svn up .
59 # Committed revision 8.
60 cd $BASE/branches/feature_branch1
61 echo -e "\nfb1 2\n" >> dummy.txt
62 svn commit -m "changed feature branch1" $CREDENTIALS
63 svn up .
64 # Committed revision 9
65 # synch feat_branch2 from feat_branch1
66 cd $BASE/branches/feature_branch2/
67 svn up .
68 svn merge $BASE_SVN_REPO/branches/feature_branch1 $CREDENTIALS --accept postpone
69 # Conflict discovered in file 'dummy.txt'. postpone
70 vi dummy.txt
71 svn resolve --accept working dummy.txt
72 svn status
73 svn commit -m "synch merge from feature_branch1 to feature_branch2" $CREDENTIALS
74 svn up .
75 # Committed revision 10.
76 cd $BASE/trunk
77 echo -e "\ntrunk 3\n" >> dummy.txt
78 svn commit -m "Changed trunk" $CREDENTIALS
79 svn up .
80 # Committed revision 11.
81 # synch fb1 with trunk
82 cd $BASE/branches/feature_branch1
83 svn merge $BASE_SVN_REPO/trunk $CREDENTIALS --accept postpone
84 vi dummy.txt # solve conflicts
85 svn resolve --accept working dummy.txt
86 svn commit -m "synch merge from parent trunk to feature branch1" $CREDENTIALS
87 # Committed revision 12.
88 svn up .
89 cd $BASE/trunk/
90 svn up .
91 svn merge $BASE_SVN_REPO/branches/feature_branch1 $CREDENTIALS --accept postpone
92 svn status
93 svn commit -m "got changes into trunk from feature branch1 (reintegrate)" $CREDENTIALS
94 # Committed revision 13.
95 # terminate feature branch 1
96 svn rm $BASE_SVN_REPO/branches/feature_branch1 $CREDENTIALS -m "removed feature branch1"
97 # Committed revision 14.
98 cd $BASE
99 svn up .
100 # add new entry to trunk
101 cd $BASE/trunk
102 echo -e "\ntrunk 4\n" >> dummy.txt
103 svn commit -m "changed trunk" $CREDENTIALS
104 #Committed revision 15
105 svn up .
106
107 svn diff $BASE_SVN_REPO/trunk@13 $BASE_SVN_REPO/trunk@15 $CREDENTIALS
108 # added trunk 4
109 svn diff $BASE_SVN_REPO/trunk@3 $BASE_SVN_REPO/trunk@13 $CREDENTIALS
110 # added fb1 1 , trunk 2 , fb1 2 , trunk 3
111 # the synch from trunk to feature branch 2 should have ....
112 # trunk1, trunk2, trunk3, trunk4, fb2 1, fb1 1, fb1 2, 7 elements
113 # merge from integrate revision to head of trunk
114 cd $BASE/branches/feat_branch2
115 svn merge $BASE_SVN_REPO/trunk@13 $BASE_SVN_REPO/trunk@HEAD $CREDENTIALS --accept postpone
116 # has all the elements
117
118 svn merge $BASE_SVN_REPO/trunk@15 $BASE_SVN_REPO/trunk@15 $CREDENTIALS --accept postpone
119 # only has 5 elements
120
121 # from fb1 creation to reintegration 13
122 svn merge $BASE_SVN_REPO/trunk@3 $BASE_SVN_REPO/trunk@13 $CREDENTIALS --accept postpone
123 # has six elements, trunk 4 was added in r15
124
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 .