[PATCH] subrepo: better prompt during merge when subrepo is missing from remote revision
Matt Mackall
mpm at selenic.com
Mon May 23 17:07:41 CDT 2011
On Sun, 2011-05-22 at 00:32 +0200, Angel Ezquerra wrote:
> # HG changeset patch
> # User Angel Ezquerra <angel.ezquerra at gmail.com>
> # Date 1301671367 -7200
> # Node ID 02375760c833bf678a5601513a5efdd09d9c1ed4
> # Parent 2c9f5897d4b7e163502b6ce56287d400da738d89
> subrepo: better prompt during merge when subrepo is missing from remote revision
>
> Without this patch, mercurial tells the user that remote removed a subrepo even
> if it was in fact added on local.
I think you've spotted a valid bug, but I think your fix is too
complicated. Please try this one:
diff -r 253bda94372e mercurial/subrepo.py
--- a/mercurial/subrepo.py Mon May 23 23:22:47 2011 +0300
+++ b/mercurial/subrepo.py Mon May 23 17:04:09 2011 -0500
@@ -137,6 +137,10 @@
elif ld == a: # remote removed, local unchanged
debug(s, "remote removed, remove")
wctx.sub(s).remove()
+ elif a == nullstate: # not present in remote or ancestor
+ debug(s, "local added, keep")
+ sm[s] = l
+ continue
else:
if repo.ui.promptchoice(
_(' local changed subrepository %s which remote removed\n'
> diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
> --- a/mercurial/subrepo.py
> +++ b/mercurial/subrepo.py
> @@ -138,12 +138,24 @@
> debug(s, "remote removed, remove")
> wctx.sub(s).remove()
> else:
> - if repo.ui.promptchoice(
> - _(' local changed subrepository %s which remote removed\n'
> - 'use (c)hanged version or (d)elete?') % s,
> - (_('&Changed'), _('&Delete')), 0):
> - debug(s, "prompt remove")
> - wctx.sub(s).remove()
> + if s in sa.keys():
> + # The ancestor contained the subrepo s,
> + # so remote must have removed it
> + if repo.ui.promptchoice(
> + _(' local changed subrepository %s which remote removed\n'
> + 'use (c)hanged version or (d)elete?') % s,
> + (_('&Changed'), _('&Delete')), 0):
> + debug(s, "prompt remove")
> + wctx.sub(s).remove()
> + else:
> + # The ancestor did not contain the subrepo s,
> + # so local must have added it
> + if repo.ui.promptchoice(
> + _(' subrepository %s was added to local but not to remote\n'
> + '(k)eep subrepository or (d)elete?') % s,
> + (_('&Keep'), _('&Delete')), 0):
> + debug(s, "prompt remove")
> + wctx.sub(s).remove()
>
> for s, r in sorted(s2.items()):
> if s in s1:
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial-devel
mailing list