##// END OF EJS Templates
subrepo: compare svn subrepo state to last committed revision...
Patrick Mezard -
r13287:d0e0d3d4 stable
parent child Browse files
Show More
@@ -499,13 +499,23 b' class svnsubrepo(abstractsubrepo):'
499 499 raise util.Abort(stderr)
500 500 return stdout
501 501
502 def _wcrev(self):
502 def _wcrevs(self):
503 # Get the working directory revision as well as the last
504 # commit revision so we can compare the subrepo state with
505 # both. We used to store the working directory one.
503 506 output = self._svncommand(['info', '--xml'])
504 507 doc = xml.dom.minidom.parseString(output)
505 508 entries = doc.getElementsByTagName('entry')
506 if not entries:
507 return '0'
508 return str(entries[0].getAttribute('revision')) or '0'
509 lastrev, rev = '0', '0'
510 if entries:
511 rev = str(entries[0].getAttribute('revision')) or '0'
512 commits = entries[0].getElementsByTagName('commit')
513 if commits:
514 lastrev = str(commits[0].getAttribute('revision')) or '0'
515 return (lastrev, rev)
516
517 def _wcrev(self):
518 return self._wcrevs()[0]
509 519
510 520 def _wcchanged(self):
511 521 """Return (changes, extchanges) where changes is True
@@ -534,7 +544,7 b' class svnsubrepo(abstractsubrepo):'
534 544 return bool(changes), False
535 545
536 546 def dirty(self):
537 if self._wcrev() == self._state[1] and not self._wcchanged()[0]:
547 if self._state[1] in self._wcrevs() and not self._wcchanged()[0]:
538 548 return False
539 549 return True
540 550
@@ -123,6 +123,25 b' change file in svn and hg, commit'
123 123 source file://*/svn-repo/src (glob)
124 124 revision 2
125 125
126 add an unrelated revision in svn and update the subrepo to without
127 bringing any changes.
128
129 $ svn mkdir --parents "$SVNREPO/unrelated" -m 'create unrelated'
130
131 Committed revision 4.
132 $ svn up s
133
134 Fetching external item into 's/externals'
135 External at revision 1.
136
137 At revision 4.
138 $ hg sum
139 parent: 2:* tip (glob)
140 Message!
141 branch: default
142 commit: (clean)
143 update: (current)
144
126 145 $ echo a > s/a
127 146
128 147 should be empty despite change to s/a
@@ -139,14 +158,14 b' add a commit from svn'
139 158 A externals/other
140 159 Updated external to revision 1.
141 160
142 Updated to revision 3.
161 Updated to revision 4.
143 162 $ echo xyz >> alpha
144 163 $ svn propset svn:mime-type 'text/xml' alpha
145 164 property 'svn:mime-type' set on 'alpha'
146 165 $ svn ci -m 'amend a from svn'
147 166 Sending src/alpha
148 167 Transmitting file data .
149 Committed revision 4.
168 Committed revision 5.
150 169 $ cd ../../sub/t
151 170
152 171 this commit from hg will fail
General Comments 0
You need to be logged in to leave comments. Login now