Mercurial > hg
annotate tests/test-git-import @ 4531:b51a8138292a
Avoid extra filelogs entries.
Right now, there are some situations in which localrepo.filecommit can
create filelog entries even though they're not needed. For example:
- permissions for a file have changed;
- qrefresh can create a filelog entry identical to its parent (see the
added test);
- convert-repo creates extra filelog entries in every merge where the
first parent has added files (for example, changeset ebebe9577a1a of
the kernel repo added extra filelog entries to files in the
arch/blackfin directory, even though the merge should only touch the
drivers/ata directory). This makes "hg log file" in a converted repo
less useful than it could be, since it may mention many merges that
don't actually touch that specific file.
They all come from the same basic problem: localrepo.commit (through
filecommit) creates new filelog entries for all files passed to it
(except for some cases during a merge).
Patch and test case provided by Benoit.
This should fix issue351.
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Sat, 09 Jun 2007 01:04:28 -0300 |
parents | ad3d5b4367cb |
children | 826659bd8053 |
rev | line source |
---|---|
2864 | 1 #!/bin/sh |
2 | |
3 hg init a | |
4 cd a | |
5 | |
6 echo % new file | |
7 hg import -mnew - <<EOF | |
8 diff --git a/new b/new | |
9 new file mode 100644 | |
10 index 0000000..7898192 | |
11 --- /dev/null | |
12 +++ b/new | |
13 @@ -0,0 +1 @@ | |
14 +a | |
15 EOF | |
16 | |
3589
1c9b6f1237e0
test for git empty new files
Brendan Cully <brendan@kublai.com>
parents:
2864
diff
changeset
|
17 echo % new empty file |
1c9b6f1237e0
test for git empty new files
Brendan Cully <brendan@kublai.com>
parents:
2864
diff
changeset
|
18 hg import -mempty - <<EOF |
1c9b6f1237e0
test for git empty new files
Brendan Cully <brendan@kublai.com>
parents:
2864
diff
changeset
|
19 diff --git a/empty b/empty |
1c9b6f1237e0
test for git empty new files
Brendan Cully <brendan@kublai.com>
parents:
2864
diff
changeset
|
20 new file mode 100644 |
1c9b6f1237e0
test for git empty new files
Brendan Cully <brendan@kublai.com>
parents:
2864
diff
changeset
|
21 EOF |
1c9b6f1237e0
test for git empty new files
Brendan Cully <brendan@kublai.com>
parents:
2864
diff
changeset
|
22 hg locate empty |
1c9b6f1237e0
test for git empty new files
Brendan Cully <brendan@kublai.com>
parents:
2864
diff
changeset
|
23 |
2864 | 24 echo % chmod +x |
25 hg import -msetx - <<EOF | |
26 diff --git a/new b/new | |
27 old mode 100644 | |
28 new mode 100755 | |
29 EOF | |
30 | |
31 test -x new || echo failed | |
32 | |
33 echo % copy | |
34 hg import -mcopy - <<EOF | |
35 diff --git a/new b/copy | |
36 old mode 100755 | |
37 new mode 100644 | |
38 similarity index 100% | |
39 copy from new | |
40 copy to copy | |
41 diff --git a/new b/copyx | |
42 similarity index 100% | |
43 copy from new | |
44 copy to copyx | |
45 EOF | |
46 | |
47 test -f copy -a ! -x copy || echo failed | |
48 test -x copyx || echo failed | |
49 cat copy | |
50 hg cat copy | |
51 | |
52 echo % rename | |
53 hg import -mrename - <<EOF | |
54 diff --git a/copy b/rename | |
55 similarity index 100% | |
56 rename from copy | |
57 rename to rename | |
58 EOF | |
59 | |
60 hg locate | |
61 | |
62 echo % delete | |
63 hg import -mdelete - <<EOF | |
64 diff --git a/copyx b/copyx | |
65 deleted file mode 100755 | |
66 index 7898192..0000000 | |
67 --- a/copyx | |
68 +++ /dev/null | |
69 @@ -1 +0,0 @@ | |
70 -a | |
71 EOF | |
72 | |
73 hg locate | |
74 test -f copyx && echo failed || true | |
75 | |
76 echo % regular diff | |
77 hg import -mregular - <<EOF | |
78 diff --git a/rename b/rename | |
79 index 7898192..72e1fe3 100644 | |
80 --- a/rename | |
81 +++ b/rename | |
82 @@ -1 +1,5 @@ | |
83 a | |
84 +a | |
85 +a | |
86 +a | |
87 +a | |
88 EOF | |
89 | |
90 echo % copy and modify | |
91 hg import -mcopymod - <<EOF | |
92 diff --git a/rename b/copy2 | |
93 similarity index 80% | |
94 copy from rename | |
95 copy to copy2 | |
96 index 72e1fe3..b53c148 100644 | |
97 --- a/rename | |
98 +++ b/copy2 | |
99 @@ -1,5 +1,5 @@ | |
100 a | |
101 a | |
102 -a | |
103 +b | |
104 a | |
105 a | |
106 EOF | |
107 | |
108 hg cat copy2 | |
109 | |
110 echo % rename and modify | |
111 hg import -mrenamemod - <<EOF | |
112 diff --git a/copy2 b/rename2 | |
113 similarity index 80% | |
114 rename from copy2 | |
115 rename to rename2 | |
116 index b53c148..8f81e29 100644 | |
117 --- a/copy2 | |
118 +++ b/rename2 | |
119 @@ -1,5 +1,5 @@ | |
120 a | |
121 a | |
122 b | |
123 -a | |
124 +c | |
125 a | |
126 EOF | |
127 | |
128 hg locate copy2 | |
129 hg cat rename2 | |
3701
05c8704a3743
handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3589
diff
changeset
|
130 |
05c8704a3743
handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3589
diff
changeset
|
131 echo % one file renamed multiple times |
05c8704a3743
handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3589
diff
changeset
|
132 hg import -mmultirenames - <<EOF |
05c8704a3743
handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3589
diff
changeset
|
133 diff --git a/rename2 b/rename3 |
05c8704a3743
handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3589
diff
changeset
|
134 rename from rename2 |
05c8704a3743
handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3589
diff
changeset
|
135 rename to rename3 |
05c8704a3743
handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3589
diff
changeset
|
136 diff --git a/rename2 b/rename3-2 |
05c8704a3743
handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3589
diff
changeset
|
137 rename from rename2 |
05c8704a3743
handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3589
diff
changeset
|
138 rename to rename3-2 |
05c8704a3743
handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3589
diff
changeset
|
139 EOF |
05c8704a3743
handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3589
diff
changeset
|
140 hg log -vCr. --template '{rev} {files} / {file_copies%filecopy}\n' |
05c8704a3743
handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3589
diff
changeset
|
141 |
05c8704a3743
handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3589
diff
changeset
|
142 hg locate rename2 rename3 rename3-2 |
05c8704a3743
handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3589
diff
changeset
|
143 hg cat rename3 |
05c8704a3743
handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3589
diff
changeset
|
144 echo |
05c8704a3743
handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3589
diff
changeset
|
145 hg cat rename3-2 |
3716
ab5600428b08
handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3701
diff
changeset
|
146 |
ab5600428b08
handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3701
diff
changeset
|
147 echo foo > foo |
ab5600428b08
handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3701
diff
changeset
|
148 hg add foo |
ab5600428b08
handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3701
diff
changeset
|
149 hg ci -m 'add foo' |
ab5600428b08
handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3701
diff
changeset
|
150 echo % binary files and regular patch hunks |
ab5600428b08
handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3701
diff
changeset
|
151 hg import -m binaryregular - <<EOF |
ab5600428b08
handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3701
diff
changeset
|
152 diff --git a/binary b/binary |
ab5600428b08
handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3701
diff
changeset
|
153 new file mode 100644 |
ab5600428b08
handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3701
diff
changeset
|
154 index 0000000000000000000000000000000000000000..593f4708db84ac8fd0f5cc47c634f38c013fe9e4 |
ab5600428b08
handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3701
diff
changeset
|
155 GIT binary patch |
ab5600428b08
handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3701
diff
changeset
|
156 literal 4 |
ab5600428b08
handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3701
diff
changeset
|
157 Lc\${NkU|;|M00aO5 |
ab5600428b08
handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3701
diff
changeset
|
158 |
ab5600428b08
handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3701
diff
changeset
|
159 diff --git a/foo b/foo2 |
ab5600428b08
handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3701
diff
changeset
|
160 rename from foo |
ab5600428b08
handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3701
diff
changeset
|
161 rename to foo2 |
ab5600428b08
handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3701
diff
changeset
|
162 EOF |
ab5600428b08
handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3701
diff
changeset
|
163 cat foo2 |
3736 | 164 hg manifest --debug | grep binary |
3717
9e248cfd8b94
handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3716
diff
changeset
|
165 |
9e248cfd8b94
handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3716
diff
changeset
|
166 echo % many binary files |
9e248cfd8b94
handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3716
diff
changeset
|
167 hg import -m multibinary - <<EOF |
9e248cfd8b94
handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3716
diff
changeset
|
168 diff --git a/mbinary1 b/mbinary1 |
9e248cfd8b94
handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3716
diff
changeset
|
169 new file mode 100644 |
9e248cfd8b94
handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3716
diff
changeset
|
170 index 0000000000000000000000000000000000000000..593f4708db84ac8fd0f5cc47c634f38c013fe9e4 |
9e248cfd8b94
handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3716
diff
changeset
|
171 GIT binary patch |
9e248cfd8b94
handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3716
diff
changeset
|
172 literal 4 |
9e248cfd8b94
handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3716
diff
changeset
|
173 Lc\${NkU|;|M00aO5 |
9e248cfd8b94
handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3716
diff
changeset
|
174 |
9e248cfd8b94
handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3716
diff
changeset
|
175 diff --git a/mbinary2 b/mbinary2 |
9e248cfd8b94
handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3716
diff
changeset
|
176 new file mode 100644 |
9e248cfd8b94
handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3716
diff
changeset
|
177 index 0000000000000000000000000000000000000000..112363ac1917b417ffbd7f376ca786a1e5fa7490 |
9e248cfd8b94
handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3716
diff
changeset
|
178 GIT binary patch |
9e248cfd8b94
handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3716
diff
changeset
|
179 literal 5 |
9e248cfd8b94
handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3716
diff
changeset
|
180 Mc\${NkU|\`?^000jF3jhEB |
9e248cfd8b94
handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3716
diff
changeset
|
181 |
9e248cfd8b94
handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3716
diff
changeset
|
182 EOF |
3736 | 183 hg manifest --debug | grep mbinary |