mercurial/subrepo.py
branchstable
changeset 16554 ae2664ee0223
parent 16530 e37199a1f9d4
child 16555 4955e7bf085c
--- a/mercurial/subrepo.py	Mon Apr 30 20:45:45 2012 +0200
+++ b/mercurial/subrepo.py	Mon Apr 30 17:03:15 2012 +0200
@@ -715,13 +715,24 @@
         return True
 
     def basestate(self):
-        return self._wcrev()
+        lastrev, rev = self._wcrevs()
+        if lastrev != rev:
+            # Last committed rev is not the same than rev. We would
+            # like to take lastrev but we do not know if the subrepo
+            # URL exists at lastrev.  Test it and fallback to rev it
+            # is not there.
+            try:
+                self._svncommand(['info', '%s@%s' % (self._state[0], lastrev)])
+                return lastrev
+            except error.Abort:
+                pass
+        return rev
 
     def commit(self, text, user, date):
         # user and date are out of our hands since svn is centralized
         changed, extchanged, missing = self._wcchanged()
         if not changed:
-            return self._wcrev()
+            return self.basestate()
         if extchanged:
             # Do not try to commit externals
             raise util.Abort(_('cannot commit svn externals'))