Mercurial > hg
changeset 13288:9c3bfba3f48d
Merge with stable
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Sat, 22 Jan 2011 16:29:10 +0100 |
parents | 189edd1b15fb (current diff) d0e0d3d43e14 (diff) |
children | 58b26b360a57 |
files | mercurial/subrepo.py |
diffstat | 2 files changed, 36 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/subrepo.py Sat Jan 22 09:13:04 2011 -0600 +++ b/mercurial/subrepo.py Sat Jan 22 16:29:10 2011 +0100 @@ -508,13 +508,23 @@ raise util.Abort(stderr) return stdout - def _wcrev(self): + def _wcrevs(self): + # Get the working directory revision as well as the last + # commit revision so we can compare the subrepo state with + # both. We used to store the working directory one. output = self._svncommand(['info', '--xml']) doc = xml.dom.minidom.parseString(output) entries = doc.getElementsByTagName('entry') - if not entries: - return '0' - return str(entries[0].getAttribute('revision')) or '0' + lastrev, rev = '0', '0' + if entries: + rev = str(entries[0].getAttribute('revision')) or '0' + commits = entries[0].getElementsByTagName('commit') + if commits: + lastrev = str(commits[0].getAttribute('revision')) or '0' + return (lastrev, rev) + + def _wcrev(self): + return self._wcrevs()[0] def _wcchanged(self): """Return (changes, extchanges) where changes is True @@ -544,7 +554,7 @@ def dirty(self, ignoreupdate=False): if not self._wcchanged()[0]: - if self._wcrev() == self._state[1] or ignoreupdate: + if self._state[1] in self._wcrevs() or ignoreupdate: return False return True
--- a/tests/test-subrepo-svn.t Sat Jan 22 09:13:04 2011 -0600 +++ b/tests/test-subrepo-svn.t Sat Jan 22 16:29:10 2011 +0100 @@ -123,6 +123,25 @@ source file://*/svn-repo/src (glob) revision 2 +add an unrelated revision in svn and update the subrepo to without +bringing any changes. + + $ svn mkdir --parents "$SVNREPO/unrelated" -m 'create unrelated' + + Committed revision 4. + $ svn up s + + Fetching external item into 's/externals' + External at revision 1. + + At revision 4. + $ hg sum + parent: 2:* tip (glob) + Message! + branch: default + commit: (clean) + update: (current) + $ echo a > s/a should be empty despite change to s/a @@ -139,14 +158,14 @@ A externals/other Updated external to revision 1. - Updated to revision 3. + Updated to revision 4. $ echo xyz >> alpha $ svn propset svn:mime-type 'text/xml' alpha property 'svn:mime-type' set on 'alpha' $ svn ci -m 'amend a from svn' Sending src/alpha Transmitting file data . - Committed revision 4. + Committed revision 5. $ cd ../../sub/t this commit from hg will fail