[PATCH 3 of 4] subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra
angel.ezquerra at gmail.com
Mon Nov 25 14:46:49 CST 2013
# HG changeset patch
# User Angel Ezquerra <angel.ezquerra at gmail.com>
# Date 1385255837 -3600
# Sun Nov 24 02:17:17 2013 +0100
# Node ID 744f6a7b25cd7ea810ddcce3724ed82108706d5c
# Parent 15941436e0ab88dee0f5321f737bcf4bc9774fce
subrepo: make it possible to update to hidden subrepo revisions
When a subrepo revision was hidden it was considered missing and mercurial was
unable to update to the corresponding parent revision. Instead warn the user of
the problem and let it choose what to do (the default is to udpate anyway).
diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
--- a/mercurial/subrepo.py
+++ b/mercurial/subrepo.py
@@ -650,7 +650,7 @@
source, revision, kind = state
urepo = self._repo.unfiltered()
if revision in urepo:
- return
+ return True
self._repo._subsource = source
srcurl = _abssource(self._repo)
other = hg.peer(self._repo, {}, srcurl)
@@ -676,13 +676,25 @@
if cleansub:
# keep the repo clean after pull
self._cachestorehash(srcurl)
+ return False
@annotatesubrepoerror
def get(self, state, overwrite=False):
- self._get(state)
+ inrepo = self._get(state)
source, revision, kind = state
- self._repo.ui.debug("getting subrepo %s\n" % self._path)
- hg.updaterepo(self._repo, revision, overwrite)
+ repo = self._repo
+ repo.ui.debug("getting subrepo %s\n" % self._path)
+ if inrepo:
+ urepo = repo.unfiltered()
+ ctx = urepo[revision]
+ if ctx.hidden():
+ choice = urepo.ui.promptchoice(
+ _('target revision (%s) in subrepo %s is hidden\n'
+ 'do you want to update to it anyway (Yn)? '
+ '$$ &Yes $$ &No') % (revision[0:12], self._path))
+ if choice == 0:
+ repo = urepo
+ hg.updaterepo(repo, revision, overwrite)
@annotatesubrepoerror
def merge(self, state):
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hg-2.4-3.patch
Type: text/x-patch
Size: 2062 bytes
Desc: not available
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20131125/3de7a983/attachment.bin>
More information about the Mercurial-devel
mailing list