[PATCH 3 of 3 STABLE?] resolve: don't abort when file is missing
Martin von Zweigbergk
martinvonz at google.com
Wed Nov 11 12:24:01 CST 2015
On Tue, Nov 10, 2015 at 5:24 PM Siddharth Agarwal <sid at less-broken.com>
wrote:
> On 11/10/15 17:20, Siddharth Agarwal wrote:
> > # HG changeset patch
> > # User Siddharth Agarwal <sid0 at fb.com>
> > # Date 1447204619 28800
> > # Tue Nov 10 17:16:59 2015 -0800
> > # Node ID 28e772623b133246812619909196efe50857309d
> > # Parent 0829cdf6d0d3da14077f4de0d73c8bddf6190f06
> > resolve: don't abort when file is missing
>
> These patches are currently written against default (actually
> clowncopter's @) but should arguably (maybe?) land in stable. However,
> the code here has changed enough that I'll have to prepare completely
> different patches for stable.
>
These are probably very old bugs, so I'd say it's not worth spending time
backporting them.
>
> >
> > A file being missing is a completely valid situation in which the user
> may want
> > to re-resolve merge conflicts. Mercurial already maintains backups of
> local
> > data, so this turns out to be easy to handle.
> >
> > diff --git a/mercurial/commands.py b/mercurial/commands.py
> > --- a/mercurial/commands.py
> > +++ b/mercurial/commands.py
> > @@ -5655,7 +5655,11 @@ def resolve(ui, repo, *pats, **opts):
> > else:
> > # backup pre-resolve (merge uses .orig for its own
> purposes)
> > a = repo.wjoin(f)
> > - util.copyfile(a, a + ".resolve")
> > + try:
> > + util.copyfile(a, a + ".resolve")
> > + except (IOError, OSError) as inst:
> > + if inst.errno != errno.ENOENT:
> > + raise
> >
> > try:
> > # preresolve file
> > @@ -5673,7 +5677,11 @@ def resolve(ui, repo, *pats, **opts):
> > # replace filemerge's .orig file with our resolve file
> > # for files in tocomplete, ms.resolve will not
> overwrite
> > # .orig -- only preresolve does
> > - util.rename(a + ".resolve", a + ".orig")
> > + try:
> > + util.rename(a + ".resolve", a + ".orig")
> > + except OSError as inst:
> > + if inst.errno != errno.ENOENT:
> > + raise
> >
> > for f in tocomplete:
> > try:
> > diff --git a/tests/test-merge-tools.t b/tests/test-merge-tools.t
> > --- a/tests/test-merge-tools.t
> > +++ b/tests/test-merge-tools.t
> > @@ -579,6 +579,33 @@ prompt with EOF
> > ? f.orig
> > # hg resolve --list
> > U f
> > + $ rm f
> > + $ hg resolve --all --config ui.merge=internal:prompt --config
> ui.interactive=true
> > + no tool found to merge f
> > + keep (l)ocal or take (o)ther?
> > + [1]
> > + $ aftermerge
> > + # cat f
> > + revision 1
> > + space
> > + # hg stat
> > + M f
> > + # hg resolve --list
> > + U f
> > + $ hg resolve --all --config ui.merge=internal:prompt
> > + no tool found to merge f
> > + keep (l)ocal or take (o)ther? l
> > + (no more unresolved files)
> > + $ aftermerge
> > + # cat f
> > + revision 1
> > + space
> > + # hg stat
> > + M f
> > + ? f.orig
> > + # hg resolve --list
> > + R f
> > +
> > ui.merge specifies internal:dump:
> >
> > $ beforemerge
> > _______________________________________________
> > Mercurial-devel mailing list
> > Mercurial-devel at selenic.com
> > https://selenic.com/mailman/listinfo/mercurial-devel
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20151111/53a1452c/attachment.html>
More information about the Mercurial-devel
mailing list