Mercurial > hg
comparison hgext/split.py @ 41966:42e2c7c52e1b
split: use the new movedirstate() we now have in scmutil
This avoids unnecessarily touching the working copy when splitting the
parent of the working copy. That also makes the test-removeemptydirs.t
case invalid, so we can just delete it.
Differential Revision: https://phab.mercurial-scm.org/D6127
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Wed, 13 Mar 2019 11:30:04 -0700 |
parents | fa88170c10bb |
children | 2372284d9457 |
comparison
equal
deleted
inserted
replaced
41965:e4ac7e63c213 | 41966:42e2c7c52e1b |
---|---|
132 | 132 |
133 def dosplit(ui, repo, tr, ctx, opts): | 133 def dosplit(ui, repo, tr, ctx, opts): |
134 committed = [] # [ctx] | 134 committed = [] # [ctx] |
135 | 135 |
136 # Set working parent to ctx.p1(), and keep working copy as ctx's content | 136 # Set working parent to ctx.p1(), and keep working copy as ctx's content |
137 # NOTE: if we can have "update without touching working copy" API, the | 137 if ctx.node() != repo.dirstate.p1(): |
138 # revert step could be cheaper. | 138 hg.clean(repo, ctx.node(), show_stats=False) |
139 hg.clean(repo, ctx.p1().node(), show_stats=False) | 139 with repo.dirstate.parentchange(): |
140 parents = repo.changelog.parents(ctx.node()) | 140 scmutil.movedirstate(repo, ctx.p1()) |
141 ui.pushbuffer() | |
142 cmdutil.revert(ui, repo, ctx, parents) | |
143 ui.popbuffer() # discard "reverting ..." messages | |
144 | 141 |
145 # Any modified, added, removed, deleted result means split is incomplete | 142 # Any modified, added, removed, deleted result means split is incomplete |
146 incomplete = lambda repo: any(repo.status()[:4]) | 143 incomplete = lambda repo: any(repo.status()[:4]) |
147 | 144 |
148 # Main split loop | 145 # Main split loop |