comparison hgext/split.py @ 38430:4f885770c4a2

split: preserve phase of commit that is being split With this change, hg split will preserve the phase of the commit that is being split, ignoring the phases.new-commit setting. Previously, we would use whatever phases.new-commit was set to (unless our parent was secret, then we would be secret even if phases.new-commit=draft). Now, splitting a draft commit with phases.new-commit=secret does not cause the new commits to become secret, and splitting a secret commit with phases.new-commit=draft and a draft parent does not cause the new commits to become draft. Test cases and commit message taken from Kyle Lippincott's D2016 (thanks!). Differential Revision: https://phab.mercurial-scm.org/D3819
author Martin von Zweigbergk <martinvonz@google.com>
date Tue, 19 Jun 2018 13:49:06 -0700
parents 5ba0cf22e4d0
children c303d65d2e34
comparison
equal deleted inserted replaced
38429:32fba6fe893d 38430:4f885770c4a2
168 168
169 if not committed: 169 if not committed:
170 raise error.Abort(_('cannot split an empty revision')) 170 raise error.Abort(_('cannot split an empty revision'))
171 171
172 scmutil.cleanupnodes(repo, {ctx.node(): [c.node() for c in committed]}, 172 scmutil.cleanupnodes(repo, {ctx.node(): [c.node() for c in committed]},
173 operation='split') 173 operation='split', fixphase=True)
174 174
175 return committed[-1] 175 return committed[-1]
176 176
177 def dorebase(ui, repo, src, destctx): 177 def dorebase(ui, repo, src, destctx):
178 rebase.rebase(ui, repo, rev=[revsetlang.formatspec('%ld', src)], 178 rebase.rebase(ui, repo, rev=[revsetlang.formatspec('%ld', src)],