Mercurial > hg
view tests/test-pull-r.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 | f2719b387380 |
children | 9263f86b9681 |
line wrap: on
line source
$ hg init repo $ cd repo $ echo foo > foo $ hg ci -qAm 'add foo' $ echo >> foo $ hg ci -m 'change foo' $ hg up -qC 0 $ echo bar > bar $ hg ci -qAm 'add bar' $ hg log changeset: 2:effea6de0384 tag: tip parent: 0:bbd179dfa0a7 user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: add bar changeset: 1:ed1b79f46b9a user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: change foo changeset: 0:bbd179dfa0a7 user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: add foo $ cd .. don't show "(+1 heads)" message when pulling closed head $ hg clone -q repo repo2 $ hg clone -q repo2 repo3 $ cd repo2 $ hg up -q 0 $ echo hello >> foo $ hg ci -mx1 created new head $ hg ci -mx2 --close-branch $ cd ../repo3 $ hg heads -q --closed 2:effea6de0384 1:ed1b79f46b9a $ hg pull pulling from $TESTTMP/repo2 (glob) searching for changes adding changesets adding manifests adding file changes added 2 changesets with 1 changes to 1 files (run 'hg update' to get a working copy) $ hg heads -q --closed 4:00cfe9073916 2:effea6de0384 1:ed1b79f46b9a $ cd .. $ hg init copy $ cd copy Pull a missing revision: $ hg pull -qr missing ../repo abort: unknown revision 'missing'! [255] Pull multiple revisions with update: $ hg pull -qu -r 0 -r 1 ../repo $ hg -q parents 0:bbd179dfa0a7 $ hg rollback repository tip rolled back to revision -1 (undo pull) working directory now based on revision -1 $ hg pull -qr 0 ../repo $ hg log changeset: 0:bbd179dfa0a7 tag: tip user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: add foo $ hg pull -qr 1 ../repo $ hg log changeset: 1:ed1b79f46b9a tag: tip user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: change foo changeset: 0:bbd179dfa0a7 user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: add foo This used to abort: received changelog group is empty: $ hg pull -qr 1 ../repo $ cd ..