( )⚙ D6882 histedit: sniff-test for untracked file conflicts before prompting for rules

This is an archive of the discontinued Mercurial Phabricator instance.

histedit: sniff-test for untracked file conflicts before prompting for rules
ClosedPublic

Authored by durin42 on Sep 25 2019, 1:54 PM.

Details

Summary

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.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

durin42 created this revision.Sep 25 2019, 1:54 PM
martinvonz added inline comments.
hgext/histedit.py
1974–1993

Would it be enough to check if any untracked file is in any of those commits? That should be a lot simpler and cheaper.

durin42 added inline comments.Sep 25 2019, 2:10 PM
hgext/histedit.py
1974–1993

Maybe? The tricky bit would be if the user has a gazillion untracked or ignored files, since both of those can come into play.

martinvonz added inline comments.Sep 25 2019, 2:24 PM
hgext/histedit.py
1974–1993

Won't they (correctly) cause a conflict with your approach too?

durin42 added inline comments.Sep 25 2019, 2:34 PM
hgext/histedit.py
1974–1993

They'll correctly cause a conflict, but I trust the merge code to efficiently figure out what paths to look up, rather than (eg) enumerating a large build/ hierarchy that's wholly ignored.

martinvonz added inline comments.Sep 25 2019, 2:39 PM
hgext/histedit.py
1974–1993

Ah, now I see what you mean. There are also config options for merge.checkunknown, merge.checkignored, and experimental.merge.checkpathconflicts (and maybe others) that my proposal would miss. So I agree with doing it the way you have.

1989

could you pass these as keyword arguments?

durin42 marked 4 inline comments as done.Sep 25 2019, 2:42 PM
durin42 updated this revision to Diff 16618.
durin42 added inline comments.Sep 25 2019, 2:43 PM
hgext/histedit.py
1989

Maybe, but I'll do what happens at the other callsite.

I also cleaned up the TODO, as I figured it out with print-debugging.

martinvonz added inline comments.Sep 25 2019, 5:04 PM
hgext/histedit.py
1975–1978

Does None (the default value for that argument) work? It seems like it should. If it does, then that seems preferable.

1987–1988

They all seem right to me. I don't think followcopies should make a difference for untracked/ignored files.

durin42 marked 2 inline comments as done.Sep 25 2019, 5:07 PM
durin42 added inline comments.
hgext/histedit.py
1975–1978

No, because that gives me the workingctx, and I need p1 of the workingctx. Again, I figured that out by printf debugging powers, it wasn't what I would have guessed (I actually expected [c] to be the right argument to calculateupdates - but the check didn't do what I needed until I was getting p1 of the workingctx like this. Sigh.)

1987–1988

Agreed. I'm just not wanting to provide a warranty that this makes sense in the future, thus the hedging.

martinvonz added inline comments.Sep 25 2019, 5:20 PM
hgext/histedit.py
1975–1978

Oh, I confused calculateupdates() arguments with update() -- calculateupdates() does not calculate a default ancestor, so you have to pass it in as you do here.

durin42 marked 2 inline comments as done.Sep 25 2019, 5:29 PM
This revision was not accepted when it landed; it landed in state Needs Review.
This revision was automatically updated to reflect the committed changes.