Mercurial > hg
view tests/test-rebase-mq-skip.t @ 22196:23fe278bde43
largefiles: keep largefiles from colliding with normal one during linear merge
Before this patch, linear merging of modified or newly added largefile
causes unexpected result, if (1) largefile collides with same name
normal one in the target revision and (2) "local" largefile is chosen,
even though branch merging between such revisions doesn't.
Expected result of such linear merging is:
(1) (not yet recorded) largefile is kept in the working directory
(2) largefile is marked as (re-)"added"
(3) colliding normal file is marked as "removed"
But actual result is:
(1) largefile in the working directory is unlinked
(2) largefile is marked as "normal" (so treated as "missing")
(3) the dirstate entry for colliding normal file is just dropped
(1) is very serious, because there is no way to restore temporarily
modified largefiles.
(3) prevents the next commit from adding the manifest with correct
"removal of (normal) file" information for newly created changeset.
The root cause of this problem is putting "lfile" into "actions['r']"
in linear-merging case. At liner merging, "actions['r']" causes:
- unlinking "target file" in the working directory, but "lfile" as
"target file" is also largefile itself in this case
- dropping the dirstate entry for target file
"actions['f']" (= "forget") does only the latter, and this is reason
why this patch doesn't choose putting "lfile" into it instead of
"actions['r']".
This patch newly introduces action "lfmr" (LargeFiles: Mark as
Removed) to mark colliding normal file as "removed" without unlinking
it.
This patch uses "hg debugdirstate" instead of "hg status" in test,
because:
- choosing "local largefile" hides "removed" status of "remote
normal file" in "hg status" output, and
- "hg status" for "large2" in this case has another problem fixed in
the subsequent patch
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Fri, 15 Aug 2014 20:28:51 +0900 |
parents | b081decd9062 |
children | 7856a87bbb02 |
line wrap: on
line source
This emulates the effects of an hg pull --rebase in which the remote repo already has one local mq patch $ cat >> $HGRCPATH <<EOF > [extensions] > rebase= > mq= > > [phases] > publish=False > > [alias] > tglog = log -G --template "{rev}: '{desc}' tags: {tags}\n" > EOF $ hg init a $ cd a $ hg qinit -c $ echo c1 > c1 $ hg add c1 $ hg ci -m C1 $ echo r1 > r1 $ hg add r1 $ hg ci -m R1 $ hg up -q 0 $ hg qnew p0.patch $ echo p0 > p0 $ hg add p0 $ hg qref -m P0 $ hg qnew p1.patch $ echo p1 > p1 $ hg add p1 $ hg qref -m P1 $ hg export qtip > p1.patch $ hg up -q -C 1 $ hg import p1.patch applying p1.patch $ rm p1.patch $ hg up -q -C qtip $ hg rebase saved backup bundle to $TESTTMP/a/.hg/strip-backup/*-backup.hg (glob) $ hg tglog @ 3: 'P0' tags: p0.patch qbase qtip tip | o 2: 'P1' tags: qparent | o 1: 'R1' tags: | o 0: 'C1' tags: $ cd .. $ hg init b $ cd b $ hg qinit -c $ for i in r0 r1 r2 r3 r4 r5 r6; > do > echo $i > $i > hg ci -Am $i > done adding r0 adding r1 adding r2 adding r3 adding r4 adding r5 adding r6 $ hg qimport -r 1:tip $ hg up -q 0 $ for i in r1 r3 r7 r8; > do > echo $i > $i > hg ci -Am branch2-$i > done adding r1 created new head adding r3 adding r7 adding r8 $ echo somethingelse > r4 $ hg ci -Am branch2-r4 adding r4 $ echo r6 > r6 $ hg ci -Am branch2-r6 adding r6 $ hg up -q qtip $ HGMERGE=internal:fail hg rebase unresolved conflicts (see hg resolve, then hg rebase --continue) [1] $ HGMERGE=internal:local hg resolve --all (no more unresolved files) $ hg rebase --continue saved backup bundle to $TESTTMP/b/.hg/strip-backup/*-backup.hg (glob) $ hg tglog @ 8: 'r5' tags: 5.diff qtip tip | o 7: 'r2' tags: 2.diff qbase | o 6: 'branch2-r6' tags: qparent | o 5: 'branch2-r4' tags: | o 4: 'branch2-r8' tags: | o 3: 'branch2-r7' tags: | o 2: 'branch2-r3' tags: | o 1: 'branch2-r1' tags: | o 0: 'r0' tags: $ cd ..