##// END OF EJS Templates
split: use the new movedirstate() we now have in scmutil...
Martin von Zweigbergk -
r42132:42e2c7c5 default
parent child Browse files
Show More
@@ -134,13 +134,10 def dosplit(ui, repo, tr, ctx, opts):
134 134 committed = [] # [ctx]
135 135
136 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
138 # revert step could be cheaper.
139 hg.clean(repo, ctx.p1().node(), show_stats=False)
140 parents = repo.changelog.parents(ctx.node())
141 ui.pushbuffer()
142 cmdutil.revert(ui, repo, ctx, parents)
143 ui.popbuffer() # discard "reverting ..." messages
137 if ctx.node() != repo.dirstate.p1():
138 hg.clean(repo, ctx.node(), show_stats=False)
139 with repo.dirstate.parentchange():
140 scmutil.movedirstate(repo, ctx.p1())
144 141
145 142 # Any modified, added, removed, deleted result means split is incomplete
146 143 incomplete = lambda repo: any(repo.status()[:4])
@@ -265,91 +265,3 Note the lack of a 'cd' being necessary
265 265 0:d17db4b0303a add bar
266 266
267 267 $ cd $TESTTMP
268
269 Testing `hg split` being run from inside of a directory that was created in the
270 commit being split:
271
272 $ hg init hgsplit
273 $ cd hgsplit
274 $ cat >> .hg/hgrc << EOF
275 > [ui]
276 > interactive = 1
277 > [extensions]
278 > split =
279 > EOF
280 $ echo anchor > anchor.txt
281 $ hg ci -qAm anchor
282
283 Create a changeset with '/otherfile_in_root' and 'somedir/foo', then try to
284 split it.
285 $ echo otherfile > otherfile_in_root
286 $ mkdir somedir
287 $ cd somedir
288 $ echo hi > foo
289 $ hg ci -qAm split_me
290 (Note: need to make this file not in this directory, or else the bug doesn't
291 reproduce; we're using a separate file due to concerns of portability on
292 `echo -e`)
293 $ cat > ../split_commands << EOF
294 > n
295 > y
296 > y
297 > a
298 > EOF
299
300 The split succeeds on no-rmcwd platforms, which alters the rest of the tests
301 #if rmcwd
302 $ cat ../split_commands | hg split
303 current directory was removed
304 (consider changing to repo root: $TESTTMP/hgsplit)
305 diff --git a/otherfile_in_root b/otherfile_in_root
306 new file mode 100644
307 examine changes to 'otherfile_in_root'? [Ynesfdaq?] n
308
309 diff --git a/somedir/foo b/somedir/foo
310 new file mode 100644
311 examine changes to 'somedir/foo'? [Ynesfdaq?] y
312
313 @@ -0,0 +1,1 @@
314 +hi
315 record change 2/2 to 'somedir/foo'? [Ynesfdaq?] y
316
317 abort: $ENOENT$
318 [255]
319 #endif
320
321 Let's try that again without the rmdir
322 $ cd $TESTTMP/hgsplit/somedir
323 Show that the previous split didn't do anything
324 $ hg log -T '{rev}:{node|short} {desc}\n'
325 1:e26b22a4f0b7 split_me
326 0:7e53273730c0 anchor
327 $ hg status
328 ? split_commands
329 Try again
330 $ cat ../split_commands | hg $NO_RM split
331 diff --git a/otherfile_in_root b/otherfile_in_root
332 new file mode 100644
333 examine changes to 'otherfile_in_root'? [Ynesfdaq?] n
334
335 diff --git a/somedir/foo b/somedir/foo
336 new file mode 100644
337 examine changes to 'somedir/foo'? [Ynesfdaq?] y
338
339 @@ -0,0 +1,1 @@
340 +hi
341 record change 2/2 to 'somedir/foo'? [Ynesfdaq?] y
342
343 created new head
344 diff --git a/otherfile_in_root b/otherfile_in_root
345 new file mode 100644
346 examine changes to 'otherfile_in_root'? [Ynesfdaq?] a
347
348 saved backup bundle to $TESTTMP/hgsplit/.hg/strip-backup/*-split.hg (glob)
349 Show that this split did something
350 $ hg log -T '{rev}:{node|short} {desc}\n'
351 2:a440f24fca4f split_me
352 1:c994f20276ab split_me
353 0:7e53273730c0 anchor
354 $ hg status
355 ? split_commands
General Comments 0
You need to be logged in to leave comments. Login now