[PATCH 1 of 1] svn subrepo: attempt work around obstructed checkouts (issue2752)

Augie Fackler durin42 at gmail.com
Fri Apr 29 03:36:51 CDT 2011


# HG changeset patch
# User Augie Fackler <durin42 at gmail.com>
# Date 1304066058 18000
# Node ID f2e55b860aa95549f1622e09e277ef2f989f3a4a
# Parent  98f79a5c308665e1ce1b020bb66ed37f47f102e6
svn subrepo: attempt work around obstructed checkouts (issue2752)

It should be possible to do better than this with 'svn switch', but
the logic required woud be significantly more complex. Until someone
needs the performance improvements of using switch, we'll just use the
same strategy for everything.

diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
--- a/mercurial/subrepo.py
+++ b/mercurial/subrepo.py
@@ -621,7 +621,15 @@
             self._svncommand(['revert', '--recursive'])
         status = self._svncommand(['checkout', state[0], '--revision', state[1]])
         if not re.search('Checked out revision [0-9]+.', status):
-            raise util.Abort(status.splitlines()[-1])
+            # catch the case where the checkout operation is
+            # obstructed but the working copy is clean
+            if ('already a working copy for a different' in status and
+                not self.dirty()):
+                self.remove()
+                self.get(state, overwrite)
+                return
+            else:
+                raise util.Abort(status.splitlines()[-1])
         self._ui.status(status)
 
     def merge(self, state):


More information about the Mercurial-devel mailing list