Show More
@@ -282,27 +282,45 class svnsubrepo(object): | |||
|
282 | 282 | return 0 |
|
283 | 283 | return int(entries[0].getAttribute('revision') or 0) |
|
284 | 284 | |
|
285 |
def _wcc |
|
|
285 | def _wcchanged(self): | |
|
286 | """Return (changes, extchanges) where changes is True | |
|
287 | if the working directory was changed, and extchanges is | |
|
288 | True if any of these changes concern an external entry. | |
|
289 | """ | |
|
286 | 290 | output = self._svncommand(['status', '--xml']) |
|
291 | externals, changes = [], [] | |
|
287 | 292 | doc = xml.dom.minidom.parseString(output) |
|
288 |
for |
|
|
289 |
s |
|
|
290 |
if |
|
|
291 |
|
|
|
292 |
|
|
|
293 | if props and props != 'none': | |
|
294 | return False | |
|
295 | return True | |
|
293 | for e in doc.getElementsByTagName('entry'): | |
|
294 | s = e.getElementsByTagName('wc-status') | |
|
295 | if not s: | |
|
296 | continue | |
|
297 | item = s[0].getAttribute('item') | |
|
298 | props = s[0].getAttribute('props') | |
|
299 | path = e.getAttribute('path') | |
|
300 | if item == 'external': | |
|
301 | externals.append(path) | |
|
302 | if (item not in ('', 'normal', 'unversioned', 'external') | |
|
303 | or props not in ('', 'none')): | |
|
304 | changes.append(path) | |
|
305 | for path in changes: | |
|
306 | for ext in externals: | |
|
307 | if path == ext or path.startswith(ext + os.sep): | |
|
308 | return True, True | |
|
309 | return bool(changes), False | |
|
296 | 310 | |
|
297 | 311 | def dirty(self): |
|
298 |
if self._wcrev() == self._state[1] and self._wcc |
|
|
312 | if self._wcrev() == self._state[1] and not self._wcchanged()[0]: | |
|
299 | 313 | return False |
|
300 | 314 | return True |
|
301 | 315 | |
|
302 | 316 | def commit(self, text, user, date): |
|
303 | 317 | # user and date are out of our hands since svn is centralized |
|
304 | if self._wcclean(): | |
|
318 | changed, extchanged = self._wcchanged() | |
|
319 | if not changed: | |
|
305 | 320 | return self._wcrev() |
|
321 | if extchanged: | |
|
322 | # Do not try to commit externals | |
|
323 | raise util.Abort(_('cannot commit svn externals')) | |
|
306 | 324 | commitinfo = self._svncommand(['commit', '-m', text]) |
|
307 | 325 | self._ui.status(commitinfo) |
|
308 | 326 | newrev = re.search('Committed revision ([\d]+).', commitinfo) |
@@ -23,9 +23,19 WCROOT="`pwd`/svn-wc" | |||
|
23 | 23 | svnadmin create svn-repo |
|
24 | 24 | svn co $SVNREPO svn-wc |
|
25 | 25 | cd svn-wc |
|
26 | echo alpha > alpha | |
|
27 | svn add alpha | |
|
26 | mkdir src | |
|
27 | echo alpha > src/alpha | |
|
28 | svn add src | |
|
29 | mkdir externals | |
|
30 | echo other > externals/other | |
|
31 | svn add externals | |
|
28 | 32 | svn ci -m 'Add alpha' |
|
33 | svn up | |
|
34 | cat > extdef <<EOF | |
|
35 | externals -r1 $SVNREPO/externals | |
|
36 | EOF | |
|
37 | svn propset -F extdef svn:externals src | |
|
38 | svn ci -m 'Setting externals' | |
|
29 | 39 | cd .. |
|
30 | 40 | |
|
31 | 41 | echo % create hg repo |
@@ -39,8 +49,8 echo a > a | |||
|
39 | 49 | hg ci -Am0 |
|
40 | 50 | |
|
41 | 51 | echo % add first svn sub |
|
42 | echo "s = [svn]$SVNREPO" >> .hgsub | |
|
43 | svn co --quiet $SVNREPO s | |
|
52 | echo "s = [svn]$SVNREPO/src" >> .hgsub | |
|
53 | svn co --quiet $SVNREPO/src s | |
|
44 | 54 | hg add .hgsub |
|
45 | 55 | hg ci -m1 |
|
46 | 56 | echo % debugsub |
@@ -60,14 +70,32 hg st | |||
|
60 | 70 | |
|
61 | 71 | echo |
|
62 | 72 | echo % add a commit from svn |
|
63 | cd "$WCROOT" | |
|
73 | cd "$WCROOT"/src | |
|
64 | 74 | svn up |
|
65 | 75 | echo xyz >> alpha |
|
76 | svn propset svn:mime-type 'text/xml' alpha | |
|
66 | 77 | svn ci -m 'amend a from svn' |
|
67 | cd ../sub/t | |
|
78 | cd ../../sub/t | |
|
79 | ||
|
68 | 80 | echo % this commit from hg will fail |
|
69 | 81 | echo zzz >> s/alpha |
|
70 | 82 | hg ci -m 'amend alpha from hg' |
|
83 | svn revert -q s/alpha | |
|
84 | ||
|
85 | echo % this commit fails because of meta changes | |
|
86 | svn propset svn:mime-type 'text/html' s/alpha | |
|
87 | hg ci -m 'amend alpha from hg' | |
|
88 | svn revert -q s/alpha | |
|
89 | ||
|
90 | echo % this commit fails because of externals changes | |
|
91 | echo zzz > s/externals/other | |
|
92 | hg ci -m 'amend externals from hg' | |
|
93 | svn revert -q s/externals/other | |
|
94 | ||
|
95 | echo % this commit fails because of externals meta changes | |
|
96 | svn propset svn:mime-type 'text/html' s/externals/other | |
|
97 | hg ci -m 'amend externals from hg' | |
|
98 | svn revert -q s/externals/other | |
|
71 | 99 | |
|
72 | 100 | echo |
|
73 | 101 | echo % clone |
@@ -1,9 +1,20 | |||
|
1 | 1 | % create subversion repo |
|
2 | 2 | Checked out revision 0. |
|
3 |
A |
|
|
4 |
A |
|
|
5 | Transmitting file data . | |
|
3 | A src | |
|
4 | A src/alpha | |
|
5 | A externals | |
|
6 | A externals/other | |
|
7 | Adding externals | |
|
8 | Adding externals/other | |
|
9 | Adding src | |
|
10 | Adding src/alpha | |
|
11 | Transmitting file data .. | |
|
6 | 12 | Committed revision 1. |
|
13 | At revision 1. | |
|
14 | property 'svn:externals' set on 'src' | |
|
15 | Sending src | |
|
16 | ||
|
17 | Committed revision 2. | |
|
7 | 18 | % create hg repo |
|
8 | 19 | % first revision, no sub |
|
9 | 20 | adding a |
@@ -11,38 +22,66 adding a | |||
|
11 | 22 | committing subrepository s |
|
12 | 23 | % debugsub |
|
13 | 24 | path s |
|
14 | source file:///root/svn-repo | |
|
15 |
revision |
|
|
25 | source file:///root/svn-repo/src | |
|
26 | revision 2 | |
|
16 | 27 | |
|
17 | 28 | % change file in svn and hg, commit |
|
18 | 29 | committing subrepository s |
|
19 | 30 | Sending s/alpha |
|
20 | 31 | Transmitting file data . |
|
21 |
Committed revision |
|
|
22 | At revision 2. | |
|
32 | Committed revision 3. | |
|
33 | ||
|
34 | Fetching external item into 's/externals' | |
|
35 | External at revision 1. | |
|
36 | ||
|
37 | At revision 3. | |
|
23 | 38 | path s |
|
24 | source file:///root/svn-repo | |
|
25 |
revision |
|
|
39 | source file:///root/svn-repo/src | |
|
40 | revision 3 | |
|
26 | 41 | |
|
27 | 42 | % should be empty despite change to s/a |
|
28 | 43 | |
|
29 | 44 | % add a commit from svn |
|
30 | 45 | U alpha |
|
31 | Updated to revision 2. | |
|
32 | Sending alpha | |
|
46 | ||
|
47 | Fetching external item into 'externals' | |
|
48 | A externals/other | |
|
49 | Updated external to revision 1. | |
|
50 | ||
|
51 | Updated to revision 3. | |
|
52 | property 'svn:mime-type' set on 'alpha' | |
|
53 | Sending src/alpha | |
|
33 | 54 | Transmitting file data . |
|
34 |
Committed revision |
|
|
55 | Committed revision 4. | |
|
35 | 56 | % this commit from hg will fail |
|
36 | 57 | committing subrepository s |
|
37 | 58 | abort: svn: Commit failed (details follow): |
|
38 | svn: File '/alpha' is out of date | |
|
59 | svn: File '/src/alpha' is out of date | |
|
60 | % this commit fails because of meta changes | |
|
61 | property 'svn:mime-type' set on 's/alpha' | |
|
62 | committing subrepository s | |
|
63 | abort: svn: Commit failed (details follow): | |
|
64 | svn: File '/src/alpha' is out of date | |
|
65 | % this commit fails because of externals changes | |
|
66 | committing subrepository s | |
|
67 | abort: cannot commit svn externals | |
|
68 | % this commit fails because of externals meta changes | |
|
69 | property 'svn:mime-type' set on 's/externals/other' | |
|
70 | committing subrepository s | |
|
71 | abort: cannot commit svn externals | |
|
39 | 72 | |
|
40 | 73 | % clone |
|
41 | 74 | updating to branch default |
|
42 | 75 | A s/alpha |
|
43 | Checked out revision 2. | |
|
76 | U s | |
|
77 | ||
|
78 | Fetching external item into 's/externals' | |
|
79 | A s/externals/other | |
|
80 | Checked out external at revision 1. | |
|
81 | ||
|
82 | Checked out revision 3. | |
|
44 | 83 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
45 | 84 | % debugsub in clone |
|
46 | 85 | path s |
|
47 | source file:///root/svn-repo | |
|
48 |
revision |
|
|
86 | source file:///root/svn-repo/src | |
|
87 | revision 3 |
General Comments 0
You need to be logged in to leave comments.
Login now