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 |