D3818: scmutil: make cleanupnodes optionally also fix the phase

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Wed Jun 20 12:49:49 EDT 2018


martinvonz added a comment.


  In https://phab.mercurial-scm.org/D3818#59697, @mharbison72 wrote:
  
  > I assume this was inspired at least in part by https://bz.mercurial-scm.org/show_bug.cgi?id=5918?
  
  
  It was inspired by https://phab.mercurial-scm.org/D2016, but I had also seen your bug report.
  
  > When I was considering how to do this, I was thinking pass in an explicit phase to handle `hg amend --secret` and similar cases, and `None` if the phase should just be inherited from the old node(s).
  
  Oh, I had not seen that you mentioned cleanupnodes() in that bug (or I did and forgot) :) That sounds like a good idea.
  
  >   Are there cases where nodes are replaced, but you don't want to change the phase at all?
  
  Yes, unfortunately: rebase and histedit (as mentioned in commit message).
  
  When I originally started working on this right after Kyle sent https://phab.mercurial-scm.org/D2016, I wanted to first fix rebase and histedit so they made the changes incrementally and we only ever had to call cleanupnodes() with one precursor. See comments on https://phab.mercurial-scm.org/D2013 for my plans. It turned out to be (more work than I had hoped)^2 (i.e. more than I had hoped after I figured out it was more than I had hoped). The issue with making rebase and histedit create obsmarkers and move bookmarks incrementally is that we need to keep track of those things so we can undo them on --abort. Then I started thinking that maybe the first step towards that goal would be to add a generic `hg undo`.
  
  Anyway, I like the idea of being able to use cleanupnodes() for amend as well. Perhaps something like this:
  
  fixphase=False, targetphase=None => leave phases alone (used by rebase and histedit)
  fixphase=True, targetphase=None => set phases based just on the precursors' phase (used by most other commands)
  fixphase=True, targetphase=<phase> => set phase to targetphase unless parent has higher phase (used by `hg amend --secret`)
  fixphase=False, targetphase=<phase> => assertion error

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3818

To: martinvonz, #hg-reviewers
Cc: mharbison72, yuja, mercurial-devel


More information about the Mercurial-devel mailing list