mercurial/subrepo.py
changeset 13288 9c3bfba3f48d
parent 13242 a8cef95cea88
parent 13287 d0e0d3d43e14
child 13323 d8d478f9ee0f
--- 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