Mercurial > public > mercurial-scm > hg-stable
diff hgext/histedit.py @ 42979:699102b10530
histedit: sniff-test for untracked file conflicts before prompting for rules
This bug is as old as histedit, which is more than 10 years! I'm a
little sad about the extra calculations here that we're just going to
throw out, but I don't see any better way to look for untracked file
conflicts and I want the bug fixed.
Differential Revision: https://phab.mercurial-scm.org/D6882
author | Augie Fackler <augie@google.com> |
---|---|
date | Wed, 25 Sep 2019 13:50:48 -0400 |
parents | 701341f57ceb |
children | b4093d1d3b18 |
line wrap: on
line diff
--- a/hgext/histedit.py Mon Sep 23 16:29:16 2019 -0400 +++ b/hgext/histedit.py Wed Sep 25 13:50:48 2019 -0400 @@ -1970,6 +1970,32 @@ node.short(root)) ctxs = [repo[r] for r in revs] + + wctx = repo[None] + # Please don't ask me why `ancestors` is this value. I figured it + # out with print-debugging, not by actually understanding what the + # merge code is doing. :( + ancs = [repo['.']] + # Sniff-test to make sure we won't collide with untracked files in + # the working directory. If we don't do this, we can get a + # collision after we've started histedit and backing out gets ugly + # for everyone, especially the user. + for c in [ctxs[0].p1()] + ctxs: + try: + mergemod.calculateupdates( + repo, wctx, c, ancs, + # These parameters were determined by print-debugging + # what happens later on inside histedit. + False, # branchmerge + False, # force + False, # acceptremote + False, # followcopies + ) + except error.Abort: + raise error.Abort( + _("untracked files in working directory conflict with files in %s") % ( + c)) + if not rules: comment = geteditcomment(ui, node.short(root), node.short(topmost)) actions = [pick(state, r) for r in revs]