[PATCH] subrepo: make it possible to update when a subrepo revision is missing

Angel Ezquerra angel.ezquerra at gmail.com
Sun Feb 9 11:45:35 CST 2014


# HG changeset patch
# User Angel Ezquerra <angel.ezquerra at gmail.com>
# Date 1391950775 -3600
#      Sun Feb 09 13:59:35 2014 +0100
# Node ID c801bcfe8b617c7e46cdaec864271d52d04dece4
# Parent  b0638b5b004d575faeb363cd6028d356dc146bc2
subrepo: make it possible to update when a subrepo revision is missing

Up until now, updating to a revision that refered to a missing subrepo revision
would fail (after trying to pull it from the remote subrepo source).

This made it very easy to get into a situation in which it was no longer
possible to update to a revision in the parent repo (for example if the user
used MQ or rebase on the subrepo).

With this change we now show a prompt which informs the user of the problem and
lets it choose what to do. By default the update will be aborted (as it did
before this patch. However the user will be able to update anyway if he wants
to.

diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
--- a/mercurial/subrepo.py
+++ b/mercurial/subrepo.py
@@ -734,6 +734,13 @@
                     _('revision %s in subrepo %s is hidden\n') \
                     % (revision[0:12], self._path))
                 repo = urepo
+        elif revision not in repo:
+            choice = repo.ui.promptchoice(
+                _('target revision (%s) in subrepo %s is missing\n'
+                  'do you want to continue with the update (yN)? '
+                  '$$ &Yes $$ &No') % (revision[0:12], self._path), default=1)
+            if choice == 0:
+                return
         hg.updaterepo(repo, revision, overwrite)
 
     @annotatesubrepoerror


More information about the Mercurial-devel mailing list