Mercurial > hg
comparison hgext/histedit.py @ 42977: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 |
comparison
equal
deleted
inserted
replaced
42976:f200bea8470b | 42977:699102b10530 |
---|---|
1968 if not revs: | 1968 if not revs: |
1969 raise error.Abort(_('%s is not an ancestor of working directory') % | 1969 raise error.Abort(_('%s is not an ancestor of working directory') % |
1970 node.short(root)) | 1970 node.short(root)) |
1971 | 1971 |
1972 ctxs = [repo[r] for r in revs] | 1972 ctxs = [repo[r] for r in revs] |
1973 | |
1974 wctx = repo[None] | |
1975 # Please don't ask me why `ancestors` is this value. I figured it | |
1976 # out with print-debugging, not by actually understanding what the | |
1977 # merge code is doing. :( | |
1978 ancs = [repo['.']] | |
1979 # Sniff-test to make sure we won't collide with untracked files in | |
1980 # the working directory. If we don't do this, we can get a | |
1981 # collision after we've started histedit and backing out gets ugly | |
1982 # for everyone, especially the user. | |
1983 for c in [ctxs[0].p1()] + ctxs: | |
1984 try: | |
1985 mergemod.calculateupdates( | |
1986 repo, wctx, c, ancs, | |
1987 # These parameters were determined by print-debugging | |
1988 # what happens later on inside histedit. | |
1989 False, # branchmerge | |
1990 False, # force | |
1991 False, # acceptremote | |
1992 False, # followcopies | |
1993 ) | |
1994 except error.Abort: | |
1995 raise error.Abort( | |
1996 _("untracked files in working directory conflict with files in %s") % ( | |
1997 c)) | |
1998 | |
1973 if not rules: | 1999 if not rules: |
1974 comment = geteditcomment(ui, node.short(root), node.short(topmost)) | 2000 comment = geteditcomment(ui, node.short(root), node.short(topmost)) |
1975 actions = [pick(state, r) for r in revs] | 2001 actions = [pick(state, r) for r in revs] |
1976 rules = ruleeditor(repo, ui, actions, comment) | 2002 rules = ruleeditor(repo, ui, actions, comment) |
1977 else: | 2003 else: |