comparison tests/test-issue3084.t @ 15663:9036c7d106bf stable

largefiles: handle merges between normal files and largefiles (issue3084) The largefiles extension prevents users from adding a normal file named 'foo' if there is already a largefile with the same name. However, there was a loop-hole: when merging, it was possible to bring in a normal file named 'foo' while also having a '.hglf/foo' file. This patch fixes this by extending the manifest merge to deal with these kinds of conflicts. If there is a normal file 'foo' in the working copy, and the other parent brings in a '.hglf/foo' file, then the user will be prompted to keep the normal file or the largefile. Likewise for the symmetric case where a normal file is brought in via the second parent. The prompt looks like this: $ hg merge foo has been turned into a largefile use (l)argefile or keep as (n)ormal file? After the merge, either the '.hglf/foo' file or the 'foo' file will have been deleted. This would cause status to return output like: $ hg status M foo R foo To fix this, the lfiles_repo.status method is changed so that a removed normal file isn't shown if there is largefile with the same name, and vice versa for largefiles.
author Martin Geisler <mg@aragost.com>
date Fri, 09 Dec 2011 17:35:00 +0100
parents
children f2719b387380
comparison
equal deleted inserted replaced
15662:06671371e634 15663:9036c7d106bf
1
2 $ echo "[extensions]" >> $HGRCPATH
3 $ echo "largefiles =" >> $HGRCPATH
4
5 Create the repository outside $HOME since largefiles write to
6 $HOME/.cache/largefiles.
7
8 $ hg init test
9 $ cd test
10 $ echo "root" > root
11 $ hg add root
12 $ hg commit -m "Root commit"
13
14 $ echo "large" > foo
15 $ hg add --large foo
16 $ hg commit -m "Add foo as a largefile"
17
18 $ hg update -r 0
19 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
20 getting changed largefiles
21 0 largefiles updated, 1 removed
22
23 $ echo "normal" > foo
24 $ hg add foo
25 $ hg commit -m "Add foo as normal file"
26 created new head
27
28 Normal file in the working copy, keeping the normal version:
29
30 $ echo "n" | hg merge --config ui.interactive=Yes
31 foo has been turned into a largefile
32 use (l)argefile or keep as (n)ormal file? 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
33 (branch merge, don't forget to commit)
34
35 $ hg status
36 $ cat foo
37 normal
38
39 Normal file in the working copy, keeping the largefile version:
40
41 $ hg update -q -C
42 $ echo "l" | hg merge --config ui.interactive=Yes
43 foo has been turned into a largefile
44 use (l)argefile or keep as (n)ormal file? 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
45 (branch merge, don't forget to commit)
46 getting changed largefiles
47 1 largefiles updated, 0 removed
48
49 $ hg status
50 M foo
51
52 $ hg diff --nodates
53 diff -r fa129ab6b5a7 .hglf/foo
54 --- /dev/null
55 +++ b/.hglf/foo
56 @@ -0,0 +1,1 @@
57 +7f7097b041ccf68cc5561e9600da4655d21c6d18
58 diff -r fa129ab6b5a7 foo
59 --- a/foo
60 +++ /dev/null
61 @@ -1,1 +0,0 @@
62 -normal
63
64 $ cat foo
65 large
66
67 Largefile in the working copy, keeping the normal version:
68
69 $ hg update -q -C -r 1
70 $ echo "n" | hg merge --config ui.interactive=Yes
71 foo has been turned into a normal file
72 keep as (l)argefile or use (n)ormal file? 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
73 (branch merge, don't forget to commit)
74 getting changed largefiles
75 0 largefiles updated, 0 removed
76
77 $ hg status
78 M foo
79
80 $ hg diff --nodates
81 diff -r ff521236428a .hglf/foo
82 --- a/.hglf/foo
83 +++ /dev/null
84 @@ -1,1 +0,0 @@
85 -7f7097b041ccf68cc5561e9600da4655d21c6d18
86 diff -r ff521236428a foo
87 --- /dev/null
88 +++ b/foo
89 @@ -0,0 +1,1 @@
90 +normal
91
92 $ cat foo
93 normal
94
95 Largefile in the working copy, keeping the largefile version:
96
97 $ hg update -q -C -r 1
98 $ echo "l" | hg merge --config ui.interactive=Yes
99 foo has been turned into a normal file
100 keep as (l)argefile or use (n)ormal file? 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
101 (branch merge, don't forget to commit)
102 getting changed largefiles
103 1 largefiles updated, 0 removed
104
105 $ hg status
106
107 $ cat foo
108 large