author | Oleksandr Gavenko <gavenkoa@gmail.com> |
Sat, 10 Feb 2018 01:36:16 +0200 | |
changeset 2229 | 1a0b6597e594 |
parent 2183 | 8d21b768f87d |
permissions | -rw-r--r-- |
1513 | 1 |
.. -*- coding: utf-8; -*- |
2 |
||
3 |
============= |
|
4 |
Subversion. |
|
5 |
============= |
|
6 |
.. contents:: |
|
1905
fba288d59662
Include only local subsections into TOC. This prevent duplication of
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1779
diff
changeset
|
7 |
:local: |
1513 | 8 |
|
2183
8d21b768f87d
Installing Subversion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2182
diff
changeset
|
9 |
Installing Subversion |
8d21b768f87d
Installing Subversion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2182
diff
changeset
|
10 |
===================== |
8d21b768f87d
Installing Subversion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2182
diff
changeset
|
11 |
|
8d21b768f87d
Installing Subversion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2182
diff
changeset
|
12 |
Under Cygwin:: |
8d21b768f87d
Installing Subversion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2182
diff
changeset
|
13 |
|
8d21b768f87d
Installing Subversion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2182
diff
changeset
|
14 |
$ apt-cyg install subversion |
8d21b768f87d
Installing Subversion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2182
diff
changeset
|
15 |
|
8d21b768f87d
Installing Subversion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2182
diff
changeset
|
16 |
Cygwin's package can't be used with native Windows applications like IDE. |
8d21b768f87d
Installing Subversion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2182
diff
changeset
|
17 |
Official home page provides own build (which require registration) and point to |
8d21b768f87d
Installing Subversion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2182
diff
changeset
|
18 |
several trusted builds: |
8d21b768f87d
Installing Subversion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2182
diff
changeset
|
19 |
|
8d21b768f87d
Installing Subversion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2182
diff
changeset
|
20 |
https://subversion.apache.org/packages.html#windows |
8d21b768f87d
Installing Subversion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2182
diff
changeset
|
21 |
Apache Subversion Binary Packages for Windows. |
8d21b768f87d
Installing Subversion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2182
diff
changeset
|
22 |
https://sliksvn.com/download/ |
8d21b768f87d
Installing Subversion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2182
diff
changeset
|
23 |
SlikSVN Windows command line client. |
8d21b768f87d
Installing Subversion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2182
diff
changeset
|
24 |
|
1513 | 25 |
Where palced config files? |
26 |
========================== |
|
27 |
||
28 |
The per-user configuration area currently contains three files two |
|
29 |
configuration files ('config' and 'servers'). |
|
30 |
||
2182
c422c3f118bd
Adjusted indent level.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
31 |
``/etc/subversion`` |
c422c3f118bd
Adjusted indent level.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
32 |
Unix system wide configurations. |
c422c3f118bd
Adjusted indent level.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
33 |
``$HOME/.subversion`` |
c422c3f118bd
Adjusted indent level.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
34 |
Unix per-user configuration area. |
c422c3f118bd
Adjusted indent level.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
35 |
``%APPDATA%\Subversion`` |
c422c3f118bd
Adjusted indent level.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
36 |
Windows per-user configuration area. |
1777 | 37 |
|
38 |
Coping repository. |
|
39 |
================== |
|
1513 | 40 |
|
1777 | 41 |
Making local repository copy:: |
42 |
||
43 |
$ svnadmin create $SVNROOT |
|
44 |
$ svnsync init file://$SVNROOT svn://$REMOTE |
|
45 |
$ svnsync synchronize file://$SVNROOT |
|
46 |
||
47 |
Note that you can't relocate working copy to new repository copy becase of:: |
|
48 |
||
49 |
$ svn relocate file://$SVNROOT |
|
50 |
svn: E195009: The repository at 'file:///home/user/devel/repo-copy' has uuid 'b064fe9f-b7ba-459e-afdf-3429ad89a318', but the WC has '11827c6b-1af5-4614-8a8b-dda7fb34cd94' |
|
51 |
||
52 |
Coping repository from SourceForge to GoogleCode:: |
|
1513 | 53 |
|
54 |
$ svnsync init https://PROJ.googlecode.com/svn https://PROJ.svn.sourceforge.net/svnroot/PROJ |
|
55 |
$ svnsync --username NAME --password PASSWORD \ |
|
56 |
sync https://PROJ.googlecode.com/svn https://PROJ.svn.sourceforge.net/svnroot/PROJ |
|
57 |
||
58 |
Disable interactive conflict resolution. |
|
59 |
======================================== |
|
60 |
||
61 |
Write in ``$HOME/.subversion/config``:: |
|
62 |
||
63 |
[miscellany] |
|
64 |
interactive-conflicts = no |
|
65 |
||
66 |
Creating svn repo. |
|
67 |
================== |
|
68 |
:: |
|
69 |
||
70 |
$ mkdir -p /srv/svn |
|
71 |
$ svnadmin create /srv/svn/$repo |
|
72 |
$ svn co file:///srv/svn/$repo $repo |
|
73 |
$ cd /tmp/$repo |
|
74 |
$ mkdir trunk branches features tags |
|
75 |
$ svn add * |
|
76 |
$ svn st # check all OK |
|
77 |
$ svn ci -m "Init repo." |
|
78 |
||
79 |
For multi-project repo do follow:: |
|
80 |
||
81 |
$ mkdir -p /srv/svn |
|
82 |
$ svnadmin create /srv/svn/$repo |
|
83 |
$ svn co file:///srv/svn/$repo $repo |
|
84 |
$ cd /tmp/$repo |
|
85 |
$ for proj in $proj1 $proj2; do mkdir $proj/trunk $proj/branches $proj/features $proj/tags; done |
|
86 |
$ svn add * |
|
87 |
$ svn st # check all OK |
|
88 |
$ svn ci -m "Init repo." |
|
89 |
||
90 |
Run local svn server. |
|
91 |
===================== |
|
92 |
:: |
|
93 |
||
1530
d41385c7d4cb
Remove unnecessary .exe command suffix.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1513
diff
changeset
|
94 |
$ svnserve -d --pid-file=svnserve.pid --root=/srv/svn/proj # default port: 3690 |
1513 | 95 |
$ svn ls svn://localhost # check all OK |
96 |
$ kill -l |
|
97 |
||
98 |
Undo bad commit. |
|
99 |
================ |
|
100 |
:: |
|
101 |
||
102 |
$ emacs FILE |
|
103 |
... |
|
104 |
$ svn ci -m "Introduce first bug." |
|
105 |
Sending trunk/FILE |
|
106 |
Transmitting file data . |
|
107 |
Committed revision 7. |
|
108 |
$ emacs FILE |
|
109 |
... |
|
110 |
$ svn ci -m "Make a lot of good changes." |
|
111 |
... |
|
112 |
Committed revision 8. |
|
113 |
... |
|
114 |
$ emacs FILE |
|
115 |
... |
|
116 |
$ svn ci -m "Introduce second bug." |
|
117 |
... |
|
118 |
Committed revision 10. |
|
119 |
$ emacs FILE |
|
120 |
... |
|
121 |
$ svn ci -m "Make a lot of good changes." |
|
122 |
... |
|
123 |
||
124 |
Now you understand that revision 7 and 10 buggy. You decide revert changes:: |
|
125 |
||
126 |
$ svn merge -r 7:6 -r 10:9 FILE |
|
127 |
$ svn ci -m "Reverted revision 7 and 10." |
|
128 |
||
129 |
For one changeset revert you can use shortly syntax:: |
|
130 |
||
131 |
$ svn merge -c -7 -c -10 FILE |
|
132 |
||
1531 | 133 |
Also you can use ranges:: |
1513 | 134 |
|
135 |
$ svn merge -r 10:6 FILE |
|
136 |
||
137 |
Merge branches. |
|
138 |
=============== |
|
139 |
:: |
|
140 |
||
141 |
$ cd trunk |
|
142 |
$ svn mergeinfo --show-revs eligible ^/branches/feature |
|
143 |
$ svn merge ^/branches/feature |
|
144 |
$ svn ci -m 'Integrate feature X.' |
|
145 |
||
1778 | 146 |
Fix EOL style. |
147 |
============== |
|
148 |
:: |
|
149 |
||
150 |
$ find . -type f -name '*.java' -exec svn propset svn:eol-style native {} ';' |
|
151 |
$ svn ci -m 'Fix svn:eol-style.' |
|
152 |
||
1779 | 153 |
Note that this actions pollute history. For example every line of file with |
154 |
CR/LF (created on Windows on file without ``svn:eol-style native``) after this |
|
155 |
actions would have new author in ``svn annotate``, and ``svn diff`` will show |
|
156 |
all on all change. |
|
157 |