##// END OF EJS Templates
py3: replace file() with open() in test-convert-git.t...
Pulkit Goyal -
r36274:9a1df914 default
parent child Browse files
Show More
@@ -1,1171 +1,1171 b''
1 #require git
1 #require git
2
2
3 $ echo "[core]" >> $HOME/.gitconfig
3 $ echo "[core]" >> $HOME/.gitconfig
4 $ echo "autocrlf = false" >> $HOME/.gitconfig
4 $ echo "autocrlf = false" >> $HOME/.gitconfig
5 $ echo "[core]" >> $HOME/.gitconfig
5 $ echo "[core]" >> $HOME/.gitconfig
6 $ echo "autocrlf = false" >> $HOME/.gitconfig
6 $ echo "autocrlf = false" >> $HOME/.gitconfig
7 $ echo "[extensions]" >> $HGRCPATH
7 $ echo "[extensions]" >> $HGRCPATH
8 $ echo "convert=" >> $HGRCPATH
8 $ echo "convert=" >> $HGRCPATH
9 $ cat >> $HGRCPATH <<EOF
9 $ cat >> $HGRCPATH <<EOF
10 > [subrepos]
10 > [subrepos]
11 > git:allowed = true
11 > git:allowed = true
12 > EOF
12 > EOF
13 $ GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME
13 $ GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME
14 $ GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL
14 $ GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL
15 $ GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0000"; export GIT_AUTHOR_DATE
15 $ GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0000"; export GIT_AUTHOR_DATE
16 $ GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME
16 $ GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME
17 $ GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL
17 $ GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL
18 $ GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE
18 $ GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE
19 $ INVALIDID1=afd12345af
19 $ INVALIDID1=afd12345af
20 $ INVALIDID2=28173x36ddd1e67bf7098d541130558ef5534a86
20 $ INVALIDID2=28173x36ddd1e67bf7098d541130558ef5534a86
21 $ VALIDID1=39b3d83f9a69a9ba4ebb111461071a0af0027357
21 $ VALIDID1=39b3d83f9a69a9ba4ebb111461071a0af0027357
22 $ VALIDID2=8dd6476bd09d9c7776355dc454dafe38efaec5da
22 $ VALIDID2=8dd6476bd09d9c7776355dc454dafe38efaec5da
23 $ count=10
23 $ count=10
24 $ commit()
24 $ commit()
25 > {
25 > {
26 > GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000"
26 > GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000"
27 > GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
27 > GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
28 > git commit "$@" >/dev/null 2>/dev/null || echo "git commit error"
28 > git commit "$@" >/dev/null 2>/dev/null || echo "git commit error"
29 > count=`expr $count + 1`
29 > count=`expr $count + 1`
30 > }
30 > }
31 $ mkdir git-repo
31 $ mkdir git-repo
32 $ cd git-repo
32 $ cd git-repo
33 $ git init-db >/dev/null 2>/dev/null
33 $ git init-db >/dev/null 2>/dev/null
34 $ echo a > a
34 $ echo a > a
35 $ mkdir d
35 $ mkdir d
36 $ echo b > d/b
36 $ echo b > d/b
37 $ git add a d
37 $ git add a d
38 $ commit -a -m t1
38 $ commit -a -m t1
39
39
40 Remove the directory, then try to replace it with a file (issue754)
40 Remove the directory, then try to replace it with a file (issue754)
41
41
42 $ git rm -f d/b
42 $ git rm -f d/b
43 rm 'd/b'
43 rm 'd/b'
44 $ commit -m t2
44 $ commit -m t2
45 $ echo d > d
45 $ echo d > d
46 $ git add d
46 $ git add d
47 $ commit -m t3
47 $ commit -m t3
48 $ echo b >> a
48 $ echo b >> a
49 $ commit -a -m t4.1
49 $ commit -a -m t4.1
50 $ git checkout -b other HEAD~ >/dev/null 2>/dev/null
50 $ git checkout -b other HEAD~ >/dev/null 2>/dev/null
51 $ echo c > a
51 $ echo c > a
52 $ echo a >> a
52 $ echo a >> a
53 $ commit -a -m t4.2
53 $ commit -a -m t4.2
54 $ git checkout master >/dev/null 2>/dev/null
54 $ git checkout master >/dev/null 2>/dev/null
55 $ git pull --no-commit . other > /dev/null 2>/dev/null
55 $ git pull --no-commit . other > /dev/null 2>/dev/null
56 $ commit -m 'Merge branch other'
56 $ commit -m 'Merge branch other'
57 $ cd ..
57 $ cd ..
58 $ hg convert --config extensions.progress= --config progress.assume-tty=1 \
58 $ hg convert --config extensions.progress= --config progress.assume-tty=1 \
59 > --config progress.delay=0 --config progress.changedelay=0 \
59 > --config progress.delay=0 --config progress.changedelay=0 \
60 > --config progress.refresh=0 --config progress.width=60 \
60 > --config progress.refresh=0 --config progress.width=60 \
61 > --config progress.format='topic, bar, number' --datesort git-repo
61 > --config progress.format='topic, bar, number' --datesort git-repo
62 \r (no-eol) (esc)
62 \r (no-eol) (esc)
63 scanning [======> ] 1/6\r (no-eol) (esc)
63 scanning [======> ] 1/6\r (no-eol) (esc)
64 scanning [=============> ] 2/6\r (no-eol) (esc)
64 scanning [=============> ] 2/6\r (no-eol) (esc)
65 scanning [=====================> ] 3/6\r (no-eol) (esc)
65 scanning [=====================> ] 3/6\r (no-eol) (esc)
66 scanning [============================> ] 4/6\r (no-eol) (esc)
66 scanning [============================> ] 4/6\r (no-eol) (esc)
67 scanning [===================================> ] 5/6\r (no-eol) (esc)
67 scanning [===================================> ] 5/6\r (no-eol) (esc)
68 scanning [===========================================>] 6/6\r (no-eol) (esc)
68 scanning [===========================================>] 6/6\r (no-eol) (esc)
69 \r (no-eol) (esc)
69 \r (no-eol) (esc)
70 \r (no-eol) (esc)
70 \r (no-eol) (esc)
71 converting [ ] 0/6\r (no-eol) (esc)
71 converting [ ] 0/6\r (no-eol) (esc)
72 getting files [==================> ] 1/2\r (no-eol) (esc)
72 getting files [==================> ] 1/2\r (no-eol) (esc)
73 getting files [======================================>] 2/2\r (no-eol) (esc)
73 getting files [======================================>] 2/2\r (no-eol) (esc)
74 \r (no-eol) (esc)
74 \r (no-eol) (esc)
75 \r (no-eol) (esc)
75 \r (no-eol) (esc)
76 converting [======> ] 1/6\r (no-eol) (esc)
76 converting [======> ] 1/6\r (no-eol) (esc)
77 getting files [======================================>] 1/1\r (no-eol) (esc)
77 getting files [======================================>] 1/1\r (no-eol) (esc)
78 \r (no-eol) (esc)
78 \r (no-eol) (esc)
79 \r (no-eol) (esc)
79 \r (no-eol) (esc)
80 converting [=============> ] 2/6\r (no-eol) (esc)
80 converting [=============> ] 2/6\r (no-eol) (esc)
81 getting files [======================================>] 1/1\r (no-eol) (esc)
81 getting files [======================================>] 1/1\r (no-eol) (esc)
82 \r (no-eol) (esc)
82 \r (no-eol) (esc)
83 \r (no-eol) (esc)
83 \r (no-eol) (esc)
84 converting [====================> ] 3/6\r (no-eol) (esc)
84 converting [====================> ] 3/6\r (no-eol) (esc)
85 getting files [======================================>] 1/1\r (no-eol) (esc)
85 getting files [======================================>] 1/1\r (no-eol) (esc)
86 \r (no-eol) (esc)
86 \r (no-eol) (esc)
87 \r (no-eol) (esc)
87 \r (no-eol) (esc)
88 converting [===========================> ] 4/6\r (no-eol) (esc)
88 converting [===========================> ] 4/6\r (no-eol) (esc)
89 getting files [======================================>] 1/1\r (no-eol) (esc)
89 getting files [======================================>] 1/1\r (no-eol) (esc)
90 \r (no-eol) (esc)
90 \r (no-eol) (esc)
91 \r (no-eol) (esc)
91 \r (no-eol) (esc)
92 converting [==================================> ] 5/6\r (no-eol) (esc)
92 converting [==================================> ] 5/6\r (no-eol) (esc)
93 getting files [======================================>] 1/1\r (no-eol) (esc)
93 getting files [======================================>] 1/1\r (no-eol) (esc)
94 \r (no-eol) (esc)
94 \r (no-eol) (esc)
95 assuming destination git-repo-hg
95 assuming destination git-repo-hg
96 initializing destination git-repo-hg repository
96 initializing destination git-repo-hg repository
97 scanning source...
97 scanning source...
98 sorting...
98 sorting...
99 converting...
99 converting...
100 5 t1
100 5 t1
101 4 t2
101 4 t2
102 3 t3
102 3 t3
103 2 t4.1
103 2 t4.1
104 1 t4.2
104 1 t4.2
105 0 Merge branch other
105 0 Merge branch other
106 updating bookmarks
106 updating bookmarks
107 $ hg up -q -R git-repo-hg
107 $ hg up -q -R git-repo-hg
108 $ hg -R git-repo-hg tip -v
108 $ hg -R git-repo-hg tip -v
109 changeset: 5:c78094926be2
109 changeset: 5:c78094926be2
110 bookmark: master
110 bookmark: master
111 tag: tip
111 tag: tip
112 parent: 3:f5f5cb45432b
112 parent: 3:f5f5cb45432b
113 parent: 4:4e174f80c67c
113 parent: 4:4e174f80c67c
114 user: test <test@example.org>
114 user: test <test@example.org>
115 date: Mon Jan 01 00:00:15 2007 +0000
115 date: Mon Jan 01 00:00:15 2007 +0000
116 files: a
116 files: a
117 description:
117 description:
118 Merge branch other
118 Merge branch other
119
119
120
120
121 $ count=10
121 $ count=10
122 $ mkdir git-repo2
122 $ mkdir git-repo2
123 $ cd git-repo2
123 $ cd git-repo2
124 $ git init-db >/dev/null 2>/dev/null
124 $ git init-db >/dev/null 2>/dev/null
125 $ echo foo > foo
125 $ echo foo > foo
126 $ git add foo
126 $ git add foo
127 $ commit -a -m 'add foo'
127 $ commit -a -m 'add foo'
128 $ echo >> foo
128 $ echo >> foo
129 $ commit -a -m 'change foo'
129 $ commit -a -m 'change foo'
130 $ git checkout -b Bar HEAD~ >/dev/null 2>/dev/null
130 $ git checkout -b Bar HEAD~ >/dev/null 2>/dev/null
131 $ echo quux >> quux
131 $ echo quux >> quux
132 $ git add quux
132 $ git add quux
133 $ commit -a -m 'add quux'
133 $ commit -a -m 'add quux'
134 $ echo bar > bar
134 $ echo bar > bar
135 $ git add bar
135 $ git add bar
136 $ commit -a -m 'add bar'
136 $ commit -a -m 'add bar'
137 $ git checkout -b Baz HEAD~ >/dev/null 2>/dev/null
137 $ git checkout -b Baz HEAD~ >/dev/null 2>/dev/null
138 $ echo baz > baz
138 $ echo baz > baz
139 $ git add baz
139 $ git add baz
140 $ commit -a -m 'add baz'
140 $ commit -a -m 'add baz'
141 $ git checkout master >/dev/null 2>/dev/null
141 $ git checkout master >/dev/null 2>/dev/null
142 $ git pull --no-commit . Bar Baz > /dev/null 2>/dev/null
142 $ git pull --no-commit . Bar Baz > /dev/null 2>/dev/null
143 $ commit -m 'Octopus merge'
143 $ commit -m 'Octopus merge'
144 $ echo bar >> bar
144 $ echo bar >> bar
145 $ commit -a -m 'change bar'
145 $ commit -a -m 'change bar'
146 $ git checkout -b Foo HEAD~ >/dev/null 2>/dev/null
146 $ git checkout -b Foo HEAD~ >/dev/null 2>/dev/null
147 $ echo >> foo
147 $ echo >> foo
148 $ commit -a -m 'change foo'
148 $ commit -a -m 'change foo'
149 $ git checkout master >/dev/null 2>/dev/null
149 $ git checkout master >/dev/null 2>/dev/null
150 $ git pull --no-commit -s ours . Foo > /dev/null 2>/dev/null
150 $ git pull --no-commit -s ours . Foo > /dev/null 2>/dev/null
151 $ commit -m 'Discard change to foo'
151 $ commit -m 'Discard change to foo'
152 $ cd ..
152 $ cd ..
153 $ glog()
153 $ glog()
154 > {
154 > {
155 > hg log -G --template '{rev} "{desc|firstline}" files: {files}\n' "$@"
155 > hg log -G --template '{rev} "{desc|firstline}" files: {files}\n' "$@"
156 > }
156 > }
157 $ splitrepo()
157 $ splitrepo()
158 > {
158 > {
159 > msg="$1"
159 > msg="$1"
160 > files="$2"
160 > files="$2"
161 > opts=$3
161 > opts=$3
162 > echo "% $files: $msg"
162 > echo "% $files: $msg"
163 > prefix=`echo "$files" | sed -e 's/ /-/g'`
163 > prefix=`echo "$files" | sed -e 's/ /-/g'`
164 > fmap="$prefix.fmap"
164 > fmap="$prefix.fmap"
165 > repo="$prefix.repo"
165 > repo="$prefix.repo"
166 > for i in $files; do
166 > for i in $files; do
167 > echo "include $i" >> "$fmap"
167 > echo "include $i" >> "$fmap"
168 > done
168 > done
169 > hg -q convert $opts --filemap "$fmap" --datesort git-repo2 "$repo"
169 > hg -q convert $opts --filemap "$fmap" --datesort git-repo2 "$repo"
170 > hg up -q -R "$repo"
170 > hg up -q -R "$repo"
171 > glog -R "$repo"
171 > glog -R "$repo"
172 > hg -R "$repo" manifest --debug
172 > hg -R "$repo" manifest --debug
173 > }
173 > }
174
174
175 full conversion
175 full conversion
176
176
177 $ hg convert --datesort git-repo2 fullrepo \
177 $ hg convert --datesort git-repo2 fullrepo \
178 > --config extensions.progress= --config progress.assume-tty=1 \
178 > --config extensions.progress= --config progress.assume-tty=1 \
179 > --config progress.delay=0 --config progress.changedelay=0 \
179 > --config progress.delay=0 --config progress.changedelay=0 \
180 > --config progress.refresh=0 --config progress.width=60 \
180 > --config progress.refresh=0 --config progress.width=60 \
181 > --config progress.format='topic, bar, number'
181 > --config progress.format='topic, bar, number'
182 \r (no-eol) (esc)
182 \r (no-eol) (esc)
183 scanning [===> ] 1/9\r (no-eol) (esc)
183 scanning [===> ] 1/9\r (no-eol) (esc)
184 scanning [========> ] 2/9\r (no-eol) (esc)
184 scanning [========> ] 2/9\r (no-eol) (esc)
185 scanning [=============> ] 3/9\r (no-eol) (esc)
185 scanning [=============> ] 3/9\r (no-eol) (esc)
186 scanning [==================> ] 4/9\r (no-eol) (esc)
186 scanning [==================> ] 4/9\r (no-eol) (esc)
187 scanning [=======================> ] 5/9\r (no-eol) (esc)
187 scanning [=======================> ] 5/9\r (no-eol) (esc)
188 scanning [============================> ] 6/9\r (no-eol) (esc)
188 scanning [============================> ] 6/9\r (no-eol) (esc)
189 scanning [=================================> ] 7/9\r (no-eol) (esc)
189 scanning [=================================> ] 7/9\r (no-eol) (esc)
190 scanning [======================================> ] 8/9\r (no-eol) (esc)
190 scanning [======================================> ] 8/9\r (no-eol) (esc)
191 scanning [===========================================>] 9/9\r (no-eol) (esc)
191 scanning [===========================================>] 9/9\r (no-eol) (esc)
192 \r (no-eol) (esc)
192 \r (no-eol) (esc)
193 \r (no-eol) (esc)
193 \r (no-eol) (esc)
194 converting [ ] 0/9\r (no-eol) (esc)
194 converting [ ] 0/9\r (no-eol) (esc)
195 getting files [======================================>] 1/1\r (no-eol) (esc)
195 getting files [======================================>] 1/1\r (no-eol) (esc)
196 \r (no-eol) (esc)
196 \r (no-eol) (esc)
197 \r (no-eol) (esc)
197 \r (no-eol) (esc)
198 converting [===> ] 1/9\r (no-eol) (esc)
198 converting [===> ] 1/9\r (no-eol) (esc)
199 getting files [======================================>] 1/1\r (no-eol) (esc)
199 getting files [======================================>] 1/1\r (no-eol) (esc)
200 \r (no-eol) (esc)
200 \r (no-eol) (esc)
201 \r (no-eol) (esc)
201 \r (no-eol) (esc)
202 converting [========> ] 2/9\r (no-eol) (esc)
202 converting [========> ] 2/9\r (no-eol) (esc)
203 getting files [======================================>] 1/1\r (no-eol) (esc)
203 getting files [======================================>] 1/1\r (no-eol) (esc)
204 \r (no-eol) (esc)
204 \r (no-eol) (esc)
205 \r (no-eol) (esc)
205 \r (no-eol) (esc)
206 converting [=============> ] 3/9\r (no-eol) (esc)
206 converting [=============> ] 3/9\r (no-eol) (esc)
207 getting files [======================================>] 1/1\r (no-eol) (esc)
207 getting files [======================================>] 1/1\r (no-eol) (esc)
208 \r (no-eol) (esc)
208 \r (no-eol) (esc)
209 \r (no-eol) (esc)
209 \r (no-eol) (esc)
210 converting [=================> ] 4/9\r (no-eol) (esc)
210 converting [=================> ] 4/9\r (no-eol) (esc)
211 getting files [======================================>] 1/1\r (no-eol) (esc)
211 getting files [======================================>] 1/1\r (no-eol) (esc)
212 \r (no-eol) (esc)
212 \r (no-eol) (esc)
213 \r (no-eol) (esc)
213 \r (no-eol) (esc)
214 converting [======================> ] 5/9\r (no-eol) (esc)
214 converting [======================> ] 5/9\r (no-eol) (esc)
215 getting files [===> ] 1/8\r (no-eol) (esc)
215 getting files [===> ] 1/8\r (no-eol) (esc)
216 getting files [========> ] 2/8\r (no-eol) (esc)
216 getting files [========> ] 2/8\r (no-eol) (esc)
217 getting files [=============> ] 3/8\r (no-eol) (esc)
217 getting files [=============> ] 3/8\r (no-eol) (esc)
218 getting files [==================> ] 4/8\r (no-eol) (esc)
218 getting files [==================> ] 4/8\r (no-eol) (esc)
219 getting files [=======================> ] 5/8\r (no-eol) (esc)
219 getting files [=======================> ] 5/8\r (no-eol) (esc)
220 getting files [============================> ] 6/8\r (no-eol) (esc)
220 getting files [============================> ] 6/8\r (no-eol) (esc)
221 getting files [=================================> ] 7/8\r (no-eol) (esc)
221 getting files [=================================> ] 7/8\r (no-eol) (esc)
222 getting files [======================================>] 8/8\r (no-eol) (esc)
222 getting files [======================================>] 8/8\r (no-eol) (esc)
223 \r (no-eol) (esc)
223 \r (no-eol) (esc)
224 \r (no-eol) (esc)
224 \r (no-eol) (esc)
225 converting [===========================> ] 6/9\r (no-eol) (esc)
225 converting [===========================> ] 6/9\r (no-eol) (esc)
226 getting files [======================================>] 1/1\r (no-eol) (esc)
226 getting files [======================================>] 1/1\r (no-eol) (esc)
227 \r (no-eol) (esc)
227 \r (no-eol) (esc)
228 \r (no-eol) (esc)
228 \r (no-eol) (esc)
229 converting [===============================> ] 7/9\r (no-eol) (esc)
229 converting [===============================> ] 7/9\r (no-eol) (esc)
230 getting files [======================================>] 1/1\r (no-eol) (esc)
230 getting files [======================================>] 1/1\r (no-eol) (esc)
231 \r (no-eol) (esc)
231 \r (no-eol) (esc)
232 \r (no-eol) (esc)
232 \r (no-eol) (esc)
233 converting [====================================> ] 8/9\r (no-eol) (esc)
233 converting [====================================> ] 8/9\r (no-eol) (esc)
234 getting files [==================> ] 1/2\r (no-eol) (esc)
234 getting files [==================> ] 1/2\r (no-eol) (esc)
235 getting files [======================================>] 2/2\r (no-eol) (esc)
235 getting files [======================================>] 2/2\r (no-eol) (esc)
236 \r (no-eol) (esc)
236 \r (no-eol) (esc)
237 initializing destination fullrepo repository
237 initializing destination fullrepo repository
238 scanning source...
238 scanning source...
239 sorting...
239 sorting...
240 converting...
240 converting...
241 8 add foo
241 8 add foo
242 7 change foo
242 7 change foo
243 6 add quux
243 6 add quux
244 5 add bar
244 5 add bar
245 4 add baz
245 4 add baz
246 3 Octopus merge
246 3 Octopus merge
247 2 change bar
247 2 change bar
248 1 change foo
248 1 change foo
249 0 Discard change to foo
249 0 Discard change to foo
250 updating bookmarks
250 updating bookmarks
251 $ hg up -q -R fullrepo
251 $ hg up -q -R fullrepo
252 $ glog -R fullrepo
252 $ glog -R fullrepo
253 @ 9 "Discard change to foo" files: foo
253 @ 9 "Discard change to foo" files: foo
254 |\
254 |\
255 | o 8 "change foo" files: foo
255 | o 8 "change foo" files: foo
256 | |
256 | |
257 o | 7 "change bar" files: bar
257 o | 7 "change bar" files: bar
258 |/
258 |/
259 o 6 "(octopus merge fixup)" files:
259 o 6 "(octopus merge fixup)" files:
260 |\
260 |\
261 | o 5 "Octopus merge" files: baz
261 | o 5 "Octopus merge" files: baz
262 | |\
262 | |\
263 o | | 4 "add baz" files: baz
263 o | | 4 "add baz" files: baz
264 | | |
264 | | |
265 +---o 3 "add bar" files: bar
265 +---o 3 "add bar" files: bar
266 | |
266 | |
267 o | 2 "add quux" files: quux
267 o | 2 "add quux" files: quux
268 | |
268 | |
269 | o 1 "change foo" files: foo
269 | o 1 "change foo" files: foo
270 |/
270 |/
271 o 0 "add foo" files: foo
271 o 0 "add foo" files: foo
272
272
273 $ hg -R fullrepo manifest --debug
273 $ hg -R fullrepo manifest --debug
274 245a3b8bc653999c2b22cdabd517ccb47aecafdf 644 bar
274 245a3b8bc653999c2b22cdabd517ccb47aecafdf 644 bar
275 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz
275 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz
276 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo
276 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo
277 88dfeab657e8cf2cef3dec67b914f49791ae76b1 644 quux
277 88dfeab657e8cf2cef3dec67b914f49791ae76b1 644 quux
278 $ splitrepo 'octopus merge' 'foo bar baz'
278 $ splitrepo 'octopus merge' 'foo bar baz'
279 % foo bar baz: octopus merge
279 % foo bar baz: octopus merge
280 @ 8 "Discard change to foo" files: foo
280 @ 8 "Discard change to foo" files: foo
281 |\
281 |\
282 | o 7 "change foo" files: foo
282 | o 7 "change foo" files: foo
283 | |
283 | |
284 o | 6 "change bar" files: bar
284 o | 6 "change bar" files: bar
285 |/
285 |/
286 o 5 "(octopus merge fixup)" files:
286 o 5 "(octopus merge fixup)" files:
287 |\
287 |\
288 | o 4 "Octopus merge" files: baz
288 | o 4 "Octopus merge" files: baz
289 | |\
289 | |\
290 o | | 3 "add baz" files: baz
290 o | | 3 "add baz" files: baz
291 | | |
291 | | |
292 +---o 2 "add bar" files: bar
292 +---o 2 "add bar" files: bar
293 | |
293 | |
294 | o 1 "change foo" files: foo
294 | o 1 "change foo" files: foo
295 |/
295 |/
296 o 0 "add foo" files: foo
296 o 0 "add foo" files: foo
297
297
298 245a3b8bc653999c2b22cdabd517ccb47aecafdf 644 bar
298 245a3b8bc653999c2b22cdabd517ccb47aecafdf 644 bar
299 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz
299 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz
300 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo
300 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo
301 $ splitrepo 'only some parents of an octopus merge; "discard" a head' 'foo baz quux'
301 $ splitrepo 'only some parents of an octopus merge; "discard" a head' 'foo baz quux'
302 % foo baz quux: only some parents of an octopus merge; "discard" a head
302 % foo baz quux: only some parents of an octopus merge; "discard" a head
303 @ 6 "Discard change to foo" files: foo
303 @ 6 "Discard change to foo" files: foo
304 |
304 |
305 o 5 "change foo" files: foo
305 o 5 "change foo" files: foo
306 |
306 |
307 o 4 "Octopus merge" files:
307 o 4 "Octopus merge" files:
308 |\
308 |\
309 | o 3 "add baz" files: baz
309 | o 3 "add baz" files: baz
310 | |
310 | |
311 | o 2 "add quux" files: quux
311 | o 2 "add quux" files: quux
312 | |
312 | |
313 o | 1 "change foo" files: foo
313 o | 1 "change foo" files: foo
314 |/
314 |/
315 o 0 "add foo" files: foo
315 o 0 "add foo" files: foo
316
316
317 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz
317 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz
318 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo
318 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo
319 88dfeab657e8cf2cef3dec67b914f49791ae76b1 644 quux
319 88dfeab657e8cf2cef3dec67b914f49791ae76b1 644 quux
320
320
321 test importing git renames and copies
321 test importing git renames and copies
322
322
323 $ cd git-repo2
323 $ cd git-repo2
324 $ git mv foo foo-renamed
324 $ git mv foo foo-renamed
325 since bar is not touched in this commit, this copy will not be detected
325 since bar is not touched in this commit, this copy will not be detected
326 $ cp bar bar-copied
326 $ cp bar bar-copied
327 $ cp baz baz-copied
327 $ cp baz baz-copied
328 $ cp baz baz-copied2
328 $ cp baz baz-copied2
329 $ cp baz ba-copy
329 $ cp baz ba-copy
330 $ echo baz2 >> baz
330 $ echo baz2 >> baz
331 $ git add bar-copied baz-copied baz-copied2 ba-copy
331 $ git add bar-copied baz-copied baz-copied2 ba-copy
332 $ commit -a -m 'rename and copy'
332 $ commit -a -m 'rename and copy'
333 $ cd ..
333 $ cd ..
334
334
335 input validation
335 input validation
336 $ hg convert --config convert.git.similarity=foo --datesort git-repo2 fullrepo
336 $ hg convert --config convert.git.similarity=foo --datesort git-repo2 fullrepo
337 abort: convert.git.similarity is not a valid integer ('foo')
337 abort: convert.git.similarity is not a valid integer ('foo')
338 [255]
338 [255]
339 $ hg convert --config convert.git.similarity=-1 --datesort git-repo2 fullrepo
339 $ hg convert --config convert.git.similarity=-1 --datesort git-repo2 fullrepo
340 abort: similarity must be between 0 and 100
340 abort: similarity must be between 0 and 100
341 [255]
341 [255]
342 $ hg convert --config convert.git.similarity=101 --datesort git-repo2 fullrepo
342 $ hg convert --config convert.git.similarity=101 --datesort git-repo2 fullrepo
343 abort: similarity must be between 0 and 100
343 abort: similarity must be between 0 and 100
344 [255]
344 [255]
345
345
346 $ hg -q convert --config convert.git.similarity=100 --datesort git-repo2 fullrepo
346 $ hg -q convert --config convert.git.similarity=100 --datesort git-repo2 fullrepo
347 $ hg -R fullrepo status -C --change master
347 $ hg -R fullrepo status -C --change master
348 M baz
348 M baz
349 A ba-copy
349 A ba-copy
350 baz
350 baz
351 A bar-copied
351 A bar-copied
352 A baz-copied
352 A baz-copied
353 baz
353 baz
354 A baz-copied2
354 A baz-copied2
355 baz
355 baz
356 A foo-renamed
356 A foo-renamed
357 foo
357 foo
358 R foo
358 R foo
359
359
360 Ensure that the modification to the copy source was preserved
360 Ensure that the modification to the copy source was preserved
361 (there was a bug where if the copy dest was alphabetically prior to the copy
361 (there was a bug where if the copy dest was alphabetically prior to the copy
362 source, the copy source took the contents of the copy dest)
362 source, the copy source took the contents of the copy dest)
363 $ hg cat -r tip fullrepo/baz
363 $ hg cat -r tip fullrepo/baz
364 baz
364 baz
365 baz2
365 baz2
366
366
367 $ cd git-repo2
367 $ cd git-repo2
368 $ echo bar2 >> bar
368 $ echo bar2 >> bar
369 $ commit -a -m 'change bar'
369 $ commit -a -m 'change bar'
370 $ cp bar bar-copied2
370 $ cp bar bar-copied2
371 $ git add bar-copied2
371 $ git add bar-copied2
372 $ commit -a -m 'copy with no changes'
372 $ commit -a -m 'copy with no changes'
373 $ cd ..
373 $ cd ..
374
374
375 $ hg -q convert --config convert.git.similarity=100 \
375 $ hg -q convert --config convert.git.similarity=100 \
376 > --config convert.git.findcopiesharder=1 --datesort git-repo2 fullrepo
376 > --config convert.git.findcopiesharder=1 --datesort git-repo2 fullrepo
377 $ hg -R fullrepo status -C --change master
377 $ hg -R fullrepo status -C --change master
378 A bar-copied2
378 A bar-copied2
379 bar
379 bar
380
380
381 renamelimit config option works
381 renamelimit config option works
382
382
383 $ cd git-repo2
383 $ cd git-repo2
384 $ cat >> copy-source << EOF
384 $ cat >> copy-source << EOF
385 > sc0
385 > sc0
386 > sc1
386 > sc1
387 > sc2
387 > sc2
388 > sc3
388 > sc3
389 > sc4
389 > sc4
390 > sc5
390 > sc5
391 > sc6
391 > sc6
392 > EOF
392 > EOF
393 $ git add copy-source
393 $ git add copy-source
394 $ commit -m 'add copy-source'
394 $ commit -m 'add copy-source'
395 $ cp copy-source source-copy0
395 $ cp copy-source source-copy0
396 $ echo 0 >> source-copy0
396 $ echo 0 >> source-copy0
397 $ cp copy-source source-copy1
397 $ cp copy-source source-copy1
398 $ echo 1 >> source-copy1
398 $ echo 1 >> source-copy1
399 $ git add source-copy0 source-copy1
399 $ git add source-copy0 source-copy1
400 $ commit -a -m 'copy copy-source 2 times'
400 $ commit -a -m 'copy copy-source 2 times'
401 $ cd ..
401 $ cd ..
402
402
403 $ hg -q convert --config convert.git.renamelimit=1 \
403 $ hg -q convert --config convert.git.renamelimit=1 \
404 > --config convert.git.findcopiesharder=true --datesort git-repo2 fullrepo2
404 > --config convert.git.findcopiesharder=true --datesort git-repo2 fullrepo2
405 $ hg -R fullrepo2 status -C --change master
405 $ hg -R fullrepo2 status -C --change master
406 A source-copy0
406 A source-copy0
407 A source-copy1
407 A source-copy1
408
408
409 $ hg -q convert --config convert.git.renamelimit=100 \
409 $ hg -q convert --config convert.git.renamelimit=100 \
410 > --config convert.git.findcopiesharder=true --datesort git-repo2 fullrepo3
410 > --config convert.git.findcopiesharder=true --datesort git-repo2 fullrepo3
411 $ hg -R fullrepo3 status -C --change master
411 $ hg -R fullrepo3 status -C --change master
412 A source-copy0
412 A source-copy0
413 copy-source
413 copy-source
414 A source-copy1
414 A source-copy1
415 copy-source
415 copy-source
416
416
417 test binary conversion (issue1359)
417 test binary conversion (issue1359)
418
418
419 $ count=19
419 $ count=19
420 $ mkdir git-repo3
420 $ mkdir git-repo3
421 $ cd git-repo3
421 $ cd git-repo3
422 $ git init-db >/dev/null 2>/dev/null
422 $ git init-db >/dev/null 2>/dev/null
423 $ $PYTHON -c 'file("b", "wb").write("".join([chr(i) for i in range(256)])*16)'
423 $ $PYTHON -c 'import struct; open("b", "wb").write(b"".join([struct.Struct(">B").pack(i) for i in range(256)])*16)'
424 $ git add b
424 $ git add b
425 $ commit -a -m addbinary
425 $ commit -a -m addbinary
426 $ cd ..
426 $ cd ..
427
427
428 convert binary file
428 convert binary file
429
429
430 $ hg convert git-repo3 git-repo3-hg
430 $ hg convert git-repo3 git-repo3-hg
431 initializing destination git-repo3-hg repository
431 initializing destination git-repo3-hg repository
432 scanning source...
432 scanning source...
433 sorting...
433 sorting...
434 converting...
434 converting...
435 0 addbinary
435 0 addbinary
436 updating bookmarks
436 updating bookmarks
437 $ cd git-repo3-hg
437 $ cd git-repo3-hg
438 $ hg up -C
438 $ hg up -C
439 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
439 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
440 $ $PYTHON -c 'print len(file("b", "rb").read())'
440 $ $PYTHON -c 'print len(open("b", "rb").read())'
441 4096
441 4096
442 $ cd ..
442 $ cd ..
443
443
444 test author vs committer
444 test author vs committer
445
445
446 $ mkdir git-repo4
446 $ mkdir git-repo4
447 $ cd git-repo4
447 $ cd git-repo4
448 $ git init-db >/dev/null 2>/dev/null
448 $ git init-db >/dev/null 2>/dev/null
449 $ echo >> foo
449 $ echo >> foo
450 $ git add foo
450 $ git add foo
451 $ commit -a -m addfoo
451 $ commit -a -m addfoo
452 $ echo >> foo
452 $ echo >> foo
453 $ GIT_AUTHOR_NAME="nottest"
453 $ GIT_AUTHOR_NAME="nottest"
454 $ commit -a -m addfoo2
454 $ commit -a -m addfoo2
455 $ cd ..
455 $ cd ..
456
456
457 convert author committer
457 convert author committer
458
458
459 $ hg convert git-repo4 git-repo4-hg
459 $ hg convert git-repo4 git-repo4-hg
460 initializing destination git-repo4-hg repository
460 initializing destination git-repo4-hg repository
461 scanning source...
461 scanning source...
462 sorting...
462 sorting...
463 converting...
463 converting...
464 1 addfoo
464 1 addfoo
465 0 addfoo2
465 0 addfoo2
466 updating bookmarks
466 updating bookmarks
467 $ hg -R git-repo4-hg log -v
467 $ hg -R git-repo4-hg log -v
468 changeset: 1:d63e967f93da
468 changeset: 1:d63e967f93da
469 bookmark: master
469 bookmark: master
470 tag: tip
470 tag: tip
471 user: nottest <test@example.org>
471 user: nottest <test@example.org>
472 date: Mon Jan 01 00:00:21 2007 +0000
472 date: Mon Jan 01 00:00:21 2007 +0000
473 files: foo
473 files: foo
474 description:
474 description:
475 addfoo2
475 addfoo2
476
476
477 committer: test <test@example.org>
477 committer: test <test@example.org>
478
478
479
479
480 changeset: 0:0735477b0224
480 changeset: 0:0735477b0224
481 user: test <test@example.org>
481 user: test <test@example.org>
482 date: Mon Jan 01 00:00:20 2007 +0000
482 date: Mon Jan 01 00:00:20 2007 +0000
483 files: foo
483 files: foo
484 description:
484 description:
485 addfoo
485 addfoo
486
486
487
487
488
488
489 Various combinations of committeractions fail
489 Various combinations of committeractions fail
490
490
491 $ hg --config convert.git.committeractions=messagedifferent,messagealways convert git-repo4 bad-committer
491 $ hg --config convert.git.committeractions=messagedifferent,messagealways convert git-repo4 bad-committer
492 initializing destination bad-committer repository
492 initializing destination bad-committer repository
493 abort: committeractions cannot define both messagedifferent and messagealways
493 abort: committeractions cannot define both messagedifferent and messagealways
494 [255]
494 [255]
495
495
496 $ hg --config convert.git.committeractions=dropcommitter,replaceauthor convert git-repo4 bad-committer
496 $ hg --config convert.git.committeractions=dropcommitter,replaceauthor convert git-repo4 bad-committer
497 initializing destination bad-committer repository
497 initializing destination bad-committer repository
498 abort: committeractions cannot define both dropcommitter and replaceauthor
498 abort: committeractions cannot define both dropcommitter and replaceauthor
499 [255]
499 [255]
500
500
501 $ hg --config convert.git.committeractions=dropcommitter,messagealways convert git-repo4 bad-committer
501 $ hg --config convert.git.committeractions=dropcommitter,messagealways convert git-repo4 bad-committer
502 initializing destination bad-committer repository
502 initializing destination bad-committer repository
503 abort: committeractions cannot define both dropcommitter and messagealways
503 abort: committeractions cannot define both dropcommitter and messagealways
504 [255]
504 [255]
505
505
506 custom prefix on messagedifferent works
506 custom prefix on messagedifferent works
507
507
508 $ hg --config convert.git.committeractions=messagedifferent=different: convert git-repo4 git-repo4-hg-messagedifferentprefix
508 $ hg --config convert.git.committeractions=messagedifferent=different: convert git-repo4 git-repo4-hg-messagedifferentprefix
509 initializing destination git-repo4-hg-messagedifferentprefix repository
509 initializing destination git-repo4-hg-messagedifferentprefix repository
510 scanning source...
510 scanning source...
511 sorting...
511 sorting...
512 converting...
512 converting...
513 1 addfoo
513 1 addfoo
514 0 addfoo2
514 0 addfoo2
515 updating bookmarks
515 updating bookmarks
516
516
517 $ hg -R git-repo4-hg-messagedifferentprefix log -v
517 $ hg -R git-repo4-hg-messagedifferentprefix log -v
518 changeset: 1:2fe0c98a109d
518 changeset: 1:2fe0c98a109d
519 bookmark: master
519 bookmark: master
520 tag: tip
520 tag: tip
521 user: nottest <test@example.org>
521 user: nottest <test@example.org>
522 date: Mon Jan 01 00:00:21 2007 +0000
522 date: Mon Jan 01 00:00:21 2007 +0000
523 files: foo
523 files: foo
524 description:
524 description:
525 addfoo2
525 addfoo2
526
526
527 different: test <test@example.org>
527 different: test <test@example.org>
528
528
529
529
530 changeset: 0:0735477b0224
530 changeset: 0:0735477b0224
531 user: test <test@example.org>
531 user: test <test@example.org>
532 date: Mon Jan 01 00:00:20 2007 +0000
532 date: Mon Jan 01 00:00:20 2007 +0000
533 files: foo
533 files: foo
534 description:
534 description:
535 addfoo
535 addfoo
536
536
537
537
538
538
539 messagealways will always add the "committer: " line even if committer identical
539 messagealways will always add the "committer: " line even if committer identical
540
540
541 $ hg --config convert.git.committeractions=messagealways convert git-repo4 git-repo4-hg-messagealways
541 $ hg --config convert.git.committeractions=messagealways convert git-repo4 git-repo4-hg-messagealways
542 initializing destination git-repo4-hg-messagealways repository
542 initializing destination git-repo4-hg-messagealways repository
543 scanning source...
543 scanning source...
544 sorting...
544 sorting...
545 converting...
545 converting...
546 1 addfoo
546 1 addfoo
547 0 addfoo2
547 0 addfoo2
548 updating bookmarks
548 updating bookmarks
549
549
550 $ hg -R git-repo4-hg-messagealways log -v
550 $ hg -R git-repo4-hg-messagealways log -v
551 changeset: 1:8db057d8cd37
551 changeset: 1:8db057d8cd37
552 bookmark: master
552 bookmark: master
553 tag: tip
553 tag: tip
554 user: nottest <test@example.org>
554 user: nottest <test@example.org>
555 date: Mon Jan 01 00:00:21 2007 +0000
555 date: Mon Jan 01 00:00:21 2007 +0000
556 files: foo
556 files: foo
557 description:
557 description:
558 addfoo2
558 addfoo2
559
559
560 committer: test <test@example.org>
560 committer: test <test@example.org>
561
561
562
562
563 changeset: 0:8f71fe9c98be
563 changeset: 0:8f71fe9c98be
564 user: test <test@example.org>
564 user: test <test@example.org>
565 date: Mon Jan 01 00:00:20 2007 +0000
565 date: Mon Jan 01 00:00:20 2007 +0000
566 files: foo
566 files: foo
567 description:
567 description:
568 addfoo
568 addfoo
569
569
570 committer: test <test@example.org>
570 committer: test <test@example.org>
571
571
572
572
573
573
574 custom prefix on messagealways works
574 custom prefix on messagealways works
575
575
576 $ hg --config convert.git.committeractions=messagealways=always: convert git-repo4 git-repo4-hg-messagealwaysprefix
576 $ hg --config convert.git.committeractions=messagealways=always: convert git-repo4 git-repo4-hg-messagealwaysprefix
577 initializing destination git-repo4-hg-messagealwaysprefix repository
577 initializing destination git-repo4-hg-messagealwaysprefix repository
578 scanning source...
578 scanning source...
579 sorting...
579 sorting...
580 converting...
580 converting...
581 1 addfoo
581 1 addfoo
582 0 addfoo2
582 0 addfoo2
583 updating bookmarks
583 updating bookmarks
584
584
585 $ hg -R git-repo4-hg-messagealwaysprefix log -v
585 $ hg -R git-repo4-hg-messagealwaysprefix log -v
586 changeset: 1:83c17174de79
586 changeset: 1:83c17174de79
587 bookmark: master
587 bookmark: master
588 tag: tip
588 tag: tip
589 user: nottest <test@example.org>
589 user: nottest <test@example.org>
590 date: Mon Jan 01 00:00:21 2007 +0000
590 date: Mon Jan 01 00:00:21 2007 +0000
591 files: foo
591 files: foo
592 description:
592 description:
593 addfoo2
593 addfoo2
594
594
595 always: test <test@example.org>
595 always: test <test@example.org>
596
596
597
597
598 changeset: 0:2ac9bcb3534a
598 changeset: 0:2ac9bcb3534a
599 user: test <test@example.org>
599 user: test <test@example.org>
600 date: Mon Jan 01 00:00:20 2007 +0000
600 date: Mon Jan 01 00:00:20 2007 +0000
601 files: foo
601 files: foo
602 description:
602 description:
603 addfoo
603 addfoo
604
604
605 always: test <test@example.org>
605 always: test <test@example.org>
606
606
607
607
608
608
609 replaceauthor replaces author with committer
609 replaceauthor replaces author with committer
610
610
611 $ hg --config convert.git.committeractions=replaceauthor convert git-repo4 git-repo4-hg-replaceauthor
611 $ hg --config convert.git.committeractions=replaceauthor convert git-repo4 git-repo4-hg-replaceauthor
612 initializing destination git-repo4-hg-replaceauthor repository
612 initializing destination git-repo4-hg-replaceauthor repository
613 scanning source...
613 scanning source...
614 sorting...
614 sorting...
615 converting...
615 converting...
616 1 addfoo
616 1 addfoo
617 0 addfoo2
617 0 addfoo2
618 updating bookmarks
618 updating bookmarks
619
619
620 $ hg -R git-repo4-hg-replaceauthor log -v
620 $ hg -R git-repo4-hg-replaceauthor log -v
621 changeset: 1:122c1d8999ea
621 changeset: 1:122c1d8999ea
622 bookmark: master
622 bookmark: master
623 tag: tip
623 tag: tip
624 user: test <test@example.org>
624 user: test <test@example.org>
625 date: Mon Jan 01 00:00:21 2007 +0000
625 date: Mon Jan 01 00:00:21 2007 +0000
626 files: foo
626 files: foo
627 description:
627 description:
628 addfoo2
628 addfoo2
629
629
630
630
631 changeset: 0:0735477b0224
631 changeset: 0:0735477b0224
632 user: test <test@example.org>
632 user: test <test@example.org>
633 date: Mon Jan 01 00:00:20 2007 +0000
633 date: Mon Jan 01 00:00:20 2007 +0000
634 files: foo
634 files: foo
635 description:
635 description:
636 addfoo
636 addfoo
637
637
638
638
639
639
640 dropcommitter removes the committer
640 dropcommitter removes the committer
641
641
642 $ hg --config convert.git.committeractions=dropcommitter convert git-repo4 git-repo4-hg-dropcommitter
642 $ hg --config convert.git.committeractions=dropcommitter convert git-repo4 git-repo4-hg-dropcommitter
643 initializing destination git-repo4-hg-dropcommitter repository
643 initializing destination git-repo4-hg-dropcommitter repository
644 scanning source...
644 scanning source...
645 sorting...
645 sorting...
646 converting...
646 converting...
647 1 addfoo
647 1 addfoo
648 0 addfoo2
648 0 addfoo2
649 updating bookmarks
649 updating bookmarks
650
650
651 $ hg -R git-repo4-hg-dropcommitter log -v
651 $ hg -R git-repo4-hg-dropcommitter log -v
652 changeset: 1:190b2da396cc
652 changeset: 1:190b2da396cc
653 bookmark: master
653 bookmark: master
654 tag: tip
654 tag: tip
655 user: nottest <test@example.org>
655 user: nottest <test@example.org>
656 date: Mon Jan 01 00:00:21 2007 +0000
656 date: Mon Jan 01 00:00:21 2007 +0000
657 files: foo
657 files: foo
658 description:
658 description:
659 addfoo2
659 addfoo2
660
660
661
661
662 changeset: 0:0735477b0224
662 changeset: 0:0735477b0224
663 user: test <test@example.org>
663 user: test <test@example.org>
664 date: Mon Jan 01 00:00:20 2007 +0000
664 date: Mon Jan 01 00:00:20 2007 +0000
665 files: foo
665 files: foo
666 description:
666 description:
667 addfoo
667 addfoo
668
668
669
669
670
670
671 --sourceorder should fail
671 --sourceorder should fail
672
672
673 $ hg convert --sourcesort git-repo4 git-repo4-sourcesort-hg
673 $ hg convert --sourcesort git-repo4 git-repo4-sourcesort-hg
674 initializing destination git-repo4-sourcesort-hg repository
674 initializing destination git-repo4-sourcesort-hg repository
675 abort: --sourcesort is not supported by this data source
675 abort: --sourcesort is not supported by this data source
676 [255]
676 [255]
677
677
678 test converting certain branches
678 test converting certain branches
679
679
680 $ mkdir git-testrevs
680 $ mkdir git-testrevs
681 $ cd git-testrevs
681 $ cd git-testrevs
682 $ git init
682 $ git init
683 Initialized empty Git repository in $TESTTMP/git-testrevs/.git/
683 Initialized empty Git repository in $TESTTMP/git-testrevs/.git/
684 $ echo a >> a ; git add a > /dev/null; git commit -m 'first' > /dev/null
684 $ echo a >> a ; git add a > /dev/null; git commit -m 'first' > /dev/null
685 $ echo a >> a ; git add a > /dev/null; git commit -m 'master commit' > /dev/null
685 $ echo a >> a ; git add a > /dev/null; git commit -m 'master commit' > /dev/null
686 $ git checkout -b goodbranch 'HEAD^'
686 $ git checkout -b goodbranch 'HEAD^'
687 Switched to a new branch 'goodbranch'
687 Switched to a new branch 'goodbranch'
688 $ echo a >> b ; git add b > /dev/null; git commit -m 'good branch commit' > /dev/null
688 $ echo a >> b ; git add b > /dev/null; git commit -m 'good branch commit' > /dev/null
689 $ git checkout -b badbranch 'HEAD^'
689 $ git checkout -b badbranch 'HEAD^'
690 Switched to a new branch 'badbranch'
690 Switched to a new branch 'badbranch'
691 $ echo a >> c ; git add c > /dev/null; git commit -m 'bad branch commit' > /dev/null
691 $ echo a >> c ; git add c > /dev/null; git commit -m 'bad branch commit' > /dev/null
692 $ cd ..
692 $ cd ..
693 $ hg convert git-testrevs hg-testrevs --rev master --rev goodbranch
693 $ hg convert git-testrevs hg-testrevs --rev master --rev goodbranch
694 initializing destination hg-testrevs repository
694 initializing destination hg-testrevs repository
695 scanning source...
695 scanning source...
696 sorting...
696 sorting...
697 converting...
697 converting...
698 2 first
698 2 first
699 1 good branch commit
699 1 good branch commit
700 0 master commit
700 0 master commit
701 updating bookmarks
701 updating bookmarks
702 $ cd hg-testrevs
702 $ cd hg-testrevs
703 $ hg log -G -T '{rev} {bookmarks}'
703 $ hg log -G -T '{rev} {bookmarks}'
704 o 2 master
704 o 2 master
705 |
705 |
706 | o 1 goodbranch
706 | o 1 goodbranch
707 |/
707 |/
708 o 0
708 o 0
709
709
710 $ cd ..
710 $ cd ..
711
711
712 test sub modules
712 test sub modules
713
713
714 $ mkdir git-repo5
714 $ mkdir git-repo5
715 $ cd git-repo5
715 $ cd git-repo5
716 $ git init-db >/dev/null 2>/dev/null
716 $ git init-db >/dev/null 2>/dev/null
717 $ echo 'sub' >> foo
717 $ echo 'sub' >> foo
718 $ git add foo
718 $ git add foo
719 $ commit -a -m 'addfoo'
719 $ commit -a -m 'addfoo'
720 $ BASE=`pwd`
720 $ BASE=`pwd`
721 $ cd ..
721 $ cd ..
722 $ mkdir git-repo6
722 $ mkdir git-repo6
723 $ cd git-repo6
723 $ cd git-repo6
724 $ git init-db >/dev/null 2>/dev/null
724 $ git init-db >/dev/null 2>/dev/null
725 $ git submodule add ${BASE} >/dev/null 2>/dev/null
725 $ git submodule add ${BASE} >/dev/null 2>/dev/null
726 $ commit -a -m 'addsubmodule' >/dev/null 2>/dev/null
726 $ commit -a -m 'addsubmodule' >/dev/null 2>/dev/null
727
727
728 test non-tab whitespace .gitmodules
728 test non-tab whitespace .gitmodules
729
729
730 $ cat >> .gitmodules <<EOF
730 $ cat >> .gitmodules <<EOF
731 > [submodule "git-repo5"]
731 > [submodule "git-repo5"]
732 > path = git-repo5
732 > path = git-repo5
733 > url = git-repo5
733 > url = git-repo5
734 > EOF
734 > EOF
735 $ git commit -q -a -m "weird white space submodule"
735 $ git commit -q -a -m "weird white space submodule"
736 $ cd ..
736 $ cd ..
737 $ hg convert git-repo6 hg-repo6
737 $ hg convert git-repo6 hg-repo6
738 initializing destination hg-repo6 repository
738 initializing destination hg-repo6 repository
739 scanning source...
739 scanning source...
740 sorting...
740 sorting...
741 converting...
741 converting...
742 1 addsubmodule
742 1 addsubmodule
743 0 weird white space submodule
743 0 weird white space submodule
744 updating bookmarks
744 updating bookmarks
745
745
746 $ rm -rf hg-repo6
746 $ rm -rf hg-repo6
747 $ cd git-repo6
747 $ cd git-repo6
748 $ git reset --hard 'HEAD^' > /dev/null
748 $ git reset --hard 'HEAD^' > /dev/null
749
749
750 test missing .gitmodules
750 test missing .gitmodules
751
751
752 $ git submodule add ../git-repo4 >/dev/null 2>/dev/null
752 $ git submodule add ../git-repo4 >/dev/null 2>/dev/null
753 $ git checkout HEAD .gitmodules
753 $ git checkout HEAD .gitmodules
754 $ git rm .gitmodules
754 $ git rm .gitmodules
755 rm '.gitmodules'
755 rm '.gitmodules'
756 $ git commit -q -m "remove .gitmodules" .gitmodules
756 $ git commit -q -m "remove .gitmodules" .gitmodules
757 $ git commit -q -m "missing .gitmodules"
757 $ git commit -q -m "missing .gitmodules"
758 $ cd ..
758 $ cd ..
759 $ hg convert git-repo6 hg-repo6 --traceback 2>&1 | grep -v "fatal: Path '.gitmodules' does not exist"
759 $ hg convert git-repo6 hg-repo6 --traceback 2>&1 | grep -v "fatal: Path '.gitmodules' does not exist"
760 initializing destination hg-repo6 repository
760 initializing destination hg-repo6 repository
761 scanning source...
761 scanning source...
762 sorting...
762 sorting...
763 converting...
763 converting...
764 2 addsubmodule
764 2 addsubmodule
765 1 remove .gitmodules
765 1 remove .gitmodules
766 0 missing .gitmodules
766 0 missing .gitmodules
767 warning: cannot read submodules config file in * (glob)
767 warning: cannot read submodules config file in * (glob)
768 updating bookmarks
768 updating bookmarks
769 $ rm -rf hg-repo6
769 $ rm -rf hg-repo6
770 $ cd git-repo6
770 $ cd git-repo6
771 $ rm -rf git-repo4
771 $ rm -rf git-repo4
772 $ git reset --hard 'HEAD^^' > /dev/null
772 $ git reset --hard 'HEAD^^' > /dev/null
773 $ cd ..
773 $ cd ..
774
774
775 test invalid splicemap1
775 test invalid splicemap1
776
776
777 $ cat > splicemap <<EOF
777 $ cat > splicemap <<EOF
778 > $VALIDID1
778 > $VALIDID1
779 > EOF
779 > EOF
780 $ hg convert --splicemap splicemap git-repo2 git-repo2-splicemap1-hg
780 $ hg convert --splicemap splicemap git-repo2 git-repo2-splicemap1-hg
781 initializing destination git-repo2-splicemap1-hg repository
781 initializing destination git-repo2-splicemap1-hg repository
782 abort: syntax error in splicemap(1): child parent1[,parent2] expected
782 abort: syntax error in splicemap(1): child parent1[,parent2] expected
783 [255]
783 [255]
784
784
785 test invalid splicemap2
785 test invalid splicemap2
786
786
787 $ cat > splicemap <<EOF
787 $ cat > splicemap <<EOF
788 > $VALIDID1 $VALIDID2, $VALIDID2, $VALIDID2
788 > $VALIDID1 $VALIDID2, $VALIDID2, $VALIDID2
789 > EOF
789 > EOF
790 $ hg convert --splicemap splicemap git-repo2 git-repo2-splicemap2-hg
790 $ hg convert --splicemap splicemap git-repo2 git-repo2-splicemap2-hg
791 initializing destination git-repo2-splicemap2-hg repository
791 initializing destination git-repo2-splicemap2-hg repository
792 abort: syntax error in splicemap(1): child parent1[,parent2] expected
792 abort: syntax error in splicemap(1): child parent1[,parent2] expected
793 [255]
793 [255]
794
794
795 test invalid splicemap3
795 test invalid splicemap3
796
796
797 $ cat > splicemap <<EOF
797 $ cat > splicemap <<EOF
798 > $INVALIDID1 $INVALIDID2
798 > $INVALIDID1 $INVALIDID2
799 > EOF
799 > EOF
800 $ hg convert --splicemap splicemap git-repo2 git-repo2-splicemap3-hg
800 $ hg convert --splicemap splicemap git-repo2 git-repo2-splicemap3-hg
801 initializing destination git-repo2-splicemap3-hg repository
801 initializing destination git-repo2-splicemap3-hg repository
802 abort: splicemap entry afd12345af is not a valid revision identifier
802 abort: splicemap entry afd12345af is not a valid revision identifier
803 [255]
803 [255]
804
804
805 convert sub modules
805 convert sub modules
806 $ hg convert git-repo6 git-repo6-hg
806 $ hg convert git-repo6 git-repo6-hg
807 initializing destination git-repo6-hg repository
807 initializing destination git-repo6-hg repository
808 scanning source...
808 scanning source...
809 sorting...
809 sorting...
810 converting...
810 converting...
811 0 addsubmodule
811 0 addsubmodule
812 updating bookmarks
812 updating bookmarks
813 $ hg -R git-repo6-hg log -v
813 $ hg -R git-repo6-hg log -v
814 changeset: 0:* (glob)
814 changeset: 0:* (glob)
815 bookmark: master
815 bookmark: master
816 tag: tip
816 tag: tip
817 user: nottest <test@example.org>
817 user: nottest <test@example.org>
818 date: Mon Jan 01 00:00:23 2007 +0000
818 date: Mon Jan 01 00:00:23 2007 +0000
819 files: .hgsub .hgsubstate
819 files: .hgsub .hgsubstate
820 description:
820 description:
821 addsubmodule
821 addsubmodule
822
822
823 committer: test <test@example.org>
823 committer: test <test@example.org>
824
824
825
825
826
826
827 $ cd git-repo6-hg
827 $ cd git-repo6-hg
828 $ hg up >/dev/null 2>/dev/null
828 $ hg up >/dev/null 2>/dev/null
829 $ cat .hgsubstate
829 $ cat .hgsubstate
830 * git-repo5 (glob)
830 * git-repo5 (glob)
831 $ cd git-repo5
831 $ cd git-repo5
832 $ cat foo
832 $ cat foo
833 sub
833 sub
834
834
835 $ cd ../..
835 $ cd ../..
836
836
837 make sure rename detection doesn't break removing and adding gitmodules
837 make sure rename detection doesn't break removing and adding gitmodules
838
838
839 $ cd git-repo6
839 $ cd git-repo6
840 $ git mv .gitmodules .gitmodules-renamed
840 $ git mv .gitmodules .gitmodules-renamed
841 $ commit -a -m 'rename .gitmodules'
841 $ commit -a -m 'rename .gitmodules'
842 $ git mv .gitmodules-renamed .gitmodules
842 $ git mv .gitmodules-renamed .gitmodules
843 $ commit -a -m 'rename .gitmodules back'
843 $ commit -a -m 'rename .gitmodules back'
844 $ cd ..
844 $ cd ..
845
845
846 $ hg --config convert.git.similarity=100 convert -q git-repo6 git-repo6-hg
846 $ hg --config convert.git.similarity=100 convert -q git-repo6 git-repo6-hg
847 $ hg -R git-repo6-hg log -r 'tip^' -T "{desc|firstline}\n"
847 $ hg -R git-repo6-hg log -r 'tip^' -T "{desc|firstline}\n"
848 rename .gitmodules
848 rename .gitmodules
849 $ hg -R git-repo6-hg status -C --change 'tip^'
849 $ hg -R git-repo6-hg status -C --change 'tip^'
850 A .gitmodules-renamed
850 A .gitmodules-renamed
851 R .hgsub
851 R .hgsub
852 R .hgsubstate
852 R .hgsubstate
853 $ hg -R git-repo6-hg log -r tip -T "{desc|firstline}\n"
853 $ hg -R git-repo6-hg log -r tip -T "{desc|firstline}\n"
854 rename .gitmodules back
854 rename .gitmodules back
855 $ hg -R git-repo6-hg status -C --change tip
855 $ hg -R git-repo6-hg status -C --change tip
856 A .hgsub
856 A .hgsub
857 A .hgsubstate
857 A .hgsubstate
858 R .gitmodules-renamed
858 R .gitmodules-renamed
859
859
860 convert the revision removing '.gitmodules' itself (and related
860 convert the revision removing '.gitmodules' itself (and related
861 submodules)
861 submodules)
862
862
863 $ cd git-repo6
863 $ cd git-repo6
864 $ git rm .gitmodules
864 $ git rm .gitmodules
865 rm '.gitmodules'
865 rm '.gitmodules'
866 $ git rm --cached git-repo5
866 $ git rm --cached git-repo5
867 rm 'git-repo5'
867 rm 'git-repo5'
868 $ commit -a -m 'remove .gitmodules and submodule git-repo5'
868 $ commit -a -m 'remove .gitmodules and submodule git-repo5'
869 $ cd ..
869 $ cd ..
870
870
871 $ hg convert -q git-repo6 git-repo6-hg
871 $ hg convert -q git-repo6 git-repo6-hg
872 $ hg -R git-repo6-hg tip -T "{desc|firstline}\n"
872 $ hg -R git-repo6-hg tip -T "{desc|firstline}\n"
873 remove .gitmodules and submodule git-repo5
873 remove .gitmodules and submodule git-repo5
874 $ hg -R git-repo6-hg tip -T "{file_dels}\n"
874 $ hg -R git-repo6-hg tip -T "{file_dels}\n"
875 .hgsub .hgsubstate
875 .hgsub .hgsubstate
876
876
877 skip submodules in the conversion
877 skip submodules in the conversion
878
878
879 $ hg convert -q git-repo6 no-submodules --config convert.git.skipsubmodules=True
879 $ hg convert -q git-repo6 no-submodules --config convert.git.skipsubmodules=True
880 $ hg -R no-submodules manifest --all
880 $ hg -R no-submodules manifest --all
881 .gitmodules-renamed
881 .gitmodules-renamed
882
882
883 convert using a different remote prefix
883 convert using a different remote prefix
884 $ git init git-repo7
884 $ git init git-repo7
885 Initialized empty Git repository in $TESTTMP/git-repo7/.git/
885 Initialized empty Git repository in $TESTTMP/git-repo7/.git/
886 $ cd git-repo7
886 $ cd git-repo7
887 TODO: it'd be nice to use (?) lines instead of grep -v to handle the
887 TODO: it'd be nice to use (?) lines instead of grep -v to handle the
888 git output variance, but that doesn't currently work in the middle of
888 git output variance, but that doesn't currently work in the middle of
889 a block, so do this for now.
889 a block, so do this for now.
890 $ touch a && git add a && git commit -am "commit a" | grep -v changed
890 $ touch a && git add a && git commit -am "commit a" | grep -v changed
891 [master (root-commit) 8ae5f69] commit a
891 [master (root-commit) 8ae5f69] commit a
892 Author: nottest <test@example.org>
892 Author: nottest <test@example.org>
893 create mode 100644 a
893 create mode 100644 a
894 $ cd ..
894 $ cd ..
895 $ git clone git-repo7 git-repo7-client
895 $ git clone git-repo7 git-repo7-client
896 Cloning into 'git-repo7-client'...
896 Cloning into 'git-repo7-client'...
897 done.
897 done.
898 $ hg convert --config convert.git.remoteprefix=origin git-repo7-client hg-repo7
898 $ hg convert --config convert.git.remoteprefix=origin git-repo7-client hg-repo7
899 initializing destination hg-repo7 repository
899 initializing destination hg-repo7 repository
900 scanning source...
900 scanning source...
901 sorting...
901 sorting...
902 converting...
902 converting...
903 0 commit a
903 0 commit a
904 updating bookmarks
904 updating bookmarks
905 $ hg -R hg-repo7 bookmarks
905 $ hg -R hg-repo7 bookmarks
906 master 0:03bf38caa4c6
906 master 0:03bf38caa4c6
907 origin/master 0:03bf38caa4c6
907 origin/master 0:03bf38caa4c6
908
908
909 Run convert when the remote branches have changed
909 Run convert when the remote branches have changed
910 (there was an old bug where the local convert read branches from the server)
910 (there was an old bug where the local convert read branches from the server)
911
911
912 $ cd git-repo7
912 $ cd git-repo7
913 $ echo a >> a
913 $ echo a >> a
914 $ git commit -q -am "move master forward"
914 $ git commit -q -am "move master forward"
915 $ cd ..
915 $ cd ..
916 $ rm -rf hg-repo7
916 $ rm -rf hg-repo7
917 $ hg convert --config convert.git.remoteprefix=origin git-repo7-client hg-repo7
917 $ hg convert --config convert.git.remoteprefix=origin git-repo7-client hg-repo7
918 initializing destination hg-repo7 repository
918 initializing destination hg-repo7 repository
919 scanning source...
919 scanning source...
920 sorting...
920 sorting...
921 converting...
921 converting...
922 0 commit a
922 0 commit a
923 updating bookmarks
923 updating bookmarks
924 $ hg -R hg-repo7 bookmarks
924 $ hg -R hg-repo7 bookmarks
925 master 0:03bf38caa4c6
925 master 0:03bf38caa4c6
926 origin/master 0:03bf38caa4c6
926 origin/master 0:03bf38caa4c6
927
927
928 damaged git repository tests:
928 damaged git repository tests:
929 In case the hard-coded hashes change, the following commands can be used to
929 In case the hard-coded hashes change, the following commands can be used to
930 list the hashes and their corresponding types in the repository:
930 list the hashes and their corresponding types in the repository:
931 cd git-repo4/.git/objects
931 cd git-repo4/.git/objects
932 find . -type f | cut -c 3- | sed 's_/__' | xargs -n 1 -t git cat-file -t
932 find . -type f | cut -c 3- | sed 's_/__' | xargs -n 1 -t git cat-file -t
933 cd ../../..
933 cd ../../..
934
934
935 damage git repository by renaming a commit object
935 damage git repository by renaming a commit object
936 $ COMMIT_OBJ=1c/0ce3c5886f83a1d78a7b517cdff5cf9ca17bdd
936 $ COMMIT_OBJ=1c/0ce3c5886f83a1d78a7b517cdff5cf9ca17bdd
937 $ mv git-repo4/.git/objects/$COMMIT_OBJ git-repo4/.git/objects/$COMMIT_OBJ.tmp
937 $ mv git-repo4/.git/objects/$COMMIT_OBJ git-repo4/.git/objects/$COMMIT_OBJ.tmp
938 $ hg convert git-repo4 git-repo4-broken-hg 2>&1 | grep 'abort:'
938 $ hg convert git-repo4 git-repo4-broken-hg 2>&1 | grep 'abort:'
939 abort: cannot retrieve number of commits in $TESTTMP/git-repo4/.git
939 abort: cannot retrieve number of commits in $TESTTMP/git-repo4/.git
940 $ mv git-repo4/.git/objects/$COMMIT_OBJ.tmp git-repo4/.git/objects/$COMMIT_OBJ
940 $ mv git-repo4/.git/objects/$COMMIT_OBJ.tmp git-repo4/.git/objects/$COMMIT_OBJ
941 damage git repository by renaming a blob object
941 damage git repository by renaming a blob object
942
942
943 $ BLOB_OBJ=8b/137891791fe96927ad78e64b0aad7bded08bdc
943 $ BLOB_OBJ=8b/137891791fe96927ad78e64b0aad7bded08bdc
944 $ mv git-repo4/.git/objects/$BLOB_OBJ git-repo4/.git/objects/$BLOB_OBJ.tmp
944 $ mv git-repo4/.git/objects/$BLOB_OBJ git-repo4/.git/objects/$BLOB_OBJ.tmp
945 $ hg convert git-repo4 git-repo4-broken-hg 2>&1 | grep 'abort:'
945 $ hg convert git-repo4 git-repo4-broken-hg 2>&1 | grep 'abort:'
946 abort: cannot read 'blob' object at 8b137891791fe96927ad78e64b0aad7bded08bdc
946 abort: cannot read 'blob' object at 8b137891791fe96927ad78e64b0aad7bded08bdc
947 $ mv git-repo4/.git/objects/$BLOB_OBJ.tmp git-repo4/.git/objects/$BLOB_OBJ
947 $ mv git-repo4/.git/objects/$BLOB_OBJ.tmp git-repo4/.git/objects/$BLOB_OBJ
948 damage git repository by renaming a tree object
948 damage git repository by renaming a tree object
949
949
950 $ TREE_OBJ=72/49f083d2a63a41cc737764a86981eb5f3e4635
950 $ TREE_OBJ=72/49f083d2a63a41cc737764a86981eb5f3e4635
951 $ mv git-repo4/.git/objects/$TREE_OBJ git-repo4/.git/objects/$TREE_OBJ.tmp
951 $ mv git-repo4/.git/objects/$TREE_OBJ git-repo4/.git/objects/$TREE_OBJ.tmp
952 $ hg convert git-repo4 git-repo4-broken-hg 2>&1 | grep 'abort:'
952 $ hg convert git-repo4 git-repo4-broken-hg 2>&1 | grep 'abort:'
953 abort: cannot read changes in 1c0ce3c5886f83a1d78a7b517cdff5cf9ca17bdd
953 abort: cannot read changes in 1c0ce3c5886f83a1d78a7b517cdff5cf9ca17bdd
954
954
955 #if no-windows git19
955 #if no-windows git19
956
956
957 test for escaping the repo name (CVE-2016-3069)
957 test for escaping the repo name (CVE-2016-3069)
958
958
959 $ git init '`echo pwned >COMMAND-INJECTION`'
959 $ git init '`echo pwned >COMMAND-INJECTION`'
960 Initialized empty Git repository in $TESTTMP/`echo pwned >COMMAND-INJECTION`/.git/
960 Initialized empty Git repository in $TESTTMP/`echo pwned >COMMAND-INJECTION`/.git/
961 $ cd '`echo pwned >COMMAND-INJECTION`'
961 $ cd '`echo pwned >COMMAND-INJECTION`'
962 $ git commit -q --allow-empty -m 'empty'
962 $ git commit -q --allow-empty -m 'empty'
963 $ cd ..
963 $ cd ..
964 $ hg convert '`echo pwned >COMMAND-INJECTION`' 'converted'
964 $ hg convert '`echo pwned >COMMAND-INJECTION`' 'converted'
965 initializing destination converted repository
965 initializing destination converted repository
966 scanning source...
966 scanning source...
967 sorting...
967 sorting...
968 converting...
968 converting...
969 0 empty
969 0 empty
970 updating bookmarks
970 updating bookmarks
971 $ test -f COMMAND-INJECTION
971 $ test -f COMMAND-INJECTION
972 [1]
972 [1]
973
973
974 test for safely passing paths to git (CVE-2016-3105)
974 test for safely passing paths to git (CVE-2016-3105)
975
975
976 $ git init 'ext::sh -c echo% pwned% >GIT-EXT-COMMAND-INJECTION% #'
976 $ git init 'ext::sh -c echo% pwned% >GIT-EXT-COMMAND-INJECTION% #'
977 Initialized empty Git repository in $TESTTMP/ext::sh -c echo% pwned% >GIT-EXT-COMMAND-INJECTION% #/.git/
977 Initialized empty Git repository in $TESTTMP/ext::sh -c echo% pwned% >GIT-EXT-COMMAND-INJECTION% #/.git/
978 $ cd 'ext::sh -c echo% pwned% >GIT-EXT-COMMAND-INJECTION% #'
978 $ cd 'ext::sh -c echo% pwned% >GIT-EXT-COMMAND-INJECTION% #'
979 $ git commit -q --allow-empty -m 'empty'
979 $ git commit -q --allow-empty -m 'empty'
980 $ cd ..
980 $ cd ..
981 $ hg convert 'ext::sh -c echo% pwned% >GIT-EXT-COMMAND-INJECTION% #' 'converted-git-ext'
981 $ hg convert 'ext::sh -c echo% pwned% >GIT-EXT-COMMAND-INJECTION% #' 'converted-git-ext'
982 initializing destination converted-git-ext repository
982 initializing destination converted-git-ext repository
983 scanning source...
983 scanning source...
984 sorting...
984 sorting...
985 converting...
985 converting...
986 0 empty
986 0 empty
987 updating bookmarks
987 updating bookmarks
988 $ test -f GIT-EXT-COMMAND-INJECTION
988 $ test -f GIT-EXT-COMMAND-INJECTION
989 [1]
989 [1]
990
990
991 #endif
991 #endif
992
992
993 Conversion of extra commit metadata to extras works
993 Conversion of extra commit metadata to extras works
994
994
995 $ git init gitextras >/dev/null 2>/dev/null
995 $ git init gitextras >/dev/null 2>/dev/null
996 $ cd gitextras
996 $ cd gitextras
997 $ touch foo
997 $ touch foo
998 $ git add foo
998 $ git add foo
999 $ commit -m initial
999 $ commit -m initial
1000 $ echo 1 > foo
1000 $ echo 1 > foo
1001 $ tree=`git write-tree`
1001 $ tree=`git write-tree`
1002
1002
1003 Git doesn't provider a user-facing API to write extra metadata into the
1003 Git doesn't provider a user-facing API to write extra metadata into the
1004 commit, so create the commit object by hand
1004 commit, so create the commit object by hand
1005
1005
1006 $ git hash-object -t commit -w --stdin << EOF
1006 $ git hash-object -t commit -w --stdin << EOF
1007 > tree ${tree}
1007 > tree ${tree}
1008 > parent ba6b1344e977ece9e00958dbbf17f1f09384b2c1
1008 > parent ba6b1344e977ece9e00958dbbf17f1f09384b2c1
1009 > author test <test@example.com> 1000000000 +0000
1009 > author test <test@example.com> 1000000000 +0000
1010 > committer test <test@example.com> 1000000000 +0000
1010 > committer test <test@example.com> 1000000000 +0000
1011 > extra-1 extra-1
1011 > extra-1 extra-1
1012 > extra-2 extra-2 with space
1012 > extra-2 extra-2 with space
1013 > convert_revision 0000aaaabbbbccccddddeeee
1013 > convert_revision 0000aaaabbbbccccddddeeee
1014 >
1014 >
1015 > message with extras
1015 > message with extras
1016 > EOF
1016 > EOF
1017 8123727c8361a4117d1a2d80e0c4e7d70c757f18
1017 8123727c8361a4117d1a2d80e0c4e7d70c757f18
1018
1018
1019 $ git reset --hard 8123727c8361a4117d1a2d80e0c4e7d70c757f18 > /dev/null
1019 $ git reset --hard 8123727c8361a4117d1a2d80e0c4e7d70c757f18 > /dev/null
1020
1020
1021 $ cd ..
1021 $ cd ..
1022
1022
1023 convert will not retain custom metadata keys by default
1023 convert will not retain custom metadata keys by default
1024
1024
1025 $ hg convert gitextras hgextras1
1025 $ hg convert gitextras hgextras1
1026 initializing destination hgextras1 repository
1026 initializing destination hgextras1 repository
1027 scanning source...
1027 scanning source...
1028 sorting...
1028 sorting...
1029 converting...
1029 converting...
1030 1 initial
1030 1 initial
1031 0 message with extras
1031 0 message with extras
1032 updating bookmarks
1032 updating bookmarks
1033
1033
1034 $ hg -R hgextras1 log --debug -r 1
1034 $ hg -R hgextras1 log --debug -r 1
1035 changeset: 1:e13a39880f68479127b2a80fa0b448cc8524aa09
1035 changeset: 1:e13a39880f68479127b2a80fa0b448cc8524aa09
1036 bookmark: master
1036 bookmark: master
1037 tag: tip
1037 tag: tip
1038 phase: draft
1038 phase: draft
1039 parent: 0:dcb68977c55cd02cbd13b901df65c4b6e7b9c4b9
1039 parent: 0:dcb68977c55cd02cbd13b901df65c4b6e7b9c4b9
1040 parent: -1:0000000000000000000000000000000000000000
1040 parent: -1:0000000000000000000000000000000000000000
1041 manifest: 0:6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50
1041 manifest: 0:6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50
1042 user: test <test@example.com>
1042 user: test <test@example.com>
1043 date: Sun Sep 09 01:46:40 2001 +0000
1043 date: Sun Sep 09 01:46:40 2001 +0000
1044 extra: branch=default
1044 extra: branch=default
1045 extra: convert_revision=8123727c8361a4117d1a2d80e0c4e7d70c757f18
1045 extra: convert_revision=8123727c8361a4117d1a2d80e0c4e7d70c757f18
1046 description:
1046 description:
1047 message with extras
1047 message with extras
1048
1048
1049
1049
1050
1050
1051 Attempting to convert a banned extra is disallowed
1051 Attempting to convert a banned extra is disallowed
1052
1052
1053 $ hg convert --config convert.git.extrakeys=tree,parent gitextras hgextras-banned
1053 $ hg convert --config convert.git.extrakeys=tree,parent gitextras hgextras-banned
1054 initializing destination hgextras-banned repository
1054 initializing destination hgextras-banned repository
1055 abort: copying of extra key is forbidden: parent, tree
1055 abort: copying of extra key is forbidden: parent, tree
1056 [255]
1056 [255]
1057
1057
1058 Converting a specific extra works
1058 Converting a specific extra works
1059
1059
1060 $ hg convert --config convert.git.extrakeys=extra-1 gitextras hgextras2
1060 $ hg convert --config convert.git.extrakeys=extra-1 gitextras hgextras2
1061 initializing destination hgextras2 repository
1061 initializing destination hgextras2 repository
1062 scanning source...
1062 scanning source...
1063 sorting...
1063 sorting...
1064 converting...
1064 converting...
1065 1 initial
1065 1 initial
1066 0 message with extras
1066 0 message with extras
1067 updating bookmarks
1067 updating bookmarks
1068
1068
1069 $ hg -R hgextras2 log --debug -r 1
1069 $ hg -R hgextras2 log --debug -r 1
1070 changeset: 1:d40fb205d58597e6ecfd55b16f198be5bf436391
1070 changeset: 1:d40fb205d58597e6ecfd55b16f198be5bf436391
1071 bookmark: master
1071 bookmark: master
1072 tag: tip
1072 tag: tip
1073 phase: draft
1073 phase: draft
1074 parent: 0:dcb68977c55cd02cbd13b901df65c4b6e7b9c4b9
1074 parent: 0:dcb68977c55cd02cbd13b901df65c4b6e7b9c4b9
1075 parent: -1:0000000000000000000000000000000000000000
1075 parent: -1:0000000000000000000000000000000000000000
1076 manifest: 0:6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50
1076 manifest: 0:6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50
1077 user: test <test@example.com>
1077 user: test <test@example.com>
1078 date: Sun Sep 09 01:46:40 2001 +0000
1078 date: Sun Sep 09 01:46:40 2001 +0000
1079 extra: branch=default
1079 extra: branch=default
1080 extra: convert_revision=8123727c8361a4117d1a2d80e0c4e7d70c757f18
1080 extra: convert_revision=8123727c8361a4117d1a2d80e0c4e7d70c757f18
1081 extra: extra-1=extra-1
1081 extra: extra-1=extra-1
1082 description:
1082 description:
1083 message with extras
1083 message with extras
1084
1084
1085
1085
1086
1086
1087 Converting multiple extras works
1087 Converting multiple extras works
1088
1088
1089 $ hg convert --config convert.git.extrakeys=extra-1,extra-2 gitextras hgextras3
1089 $ hg convert --config convert.git.extrakeys=extra-1,extra-2 gitextras hgextras3
1090 initializing destination hgextras3 repository
1090 initializing destination hgextras3 repository
1091 scanning source...
1091 scanning source...
1092 sorting...
1092 sorting...
1093 converting...
1093 converting...
1094 1 initial
1094 1 initial
1095 0 message with extras
1095 0 message with extras
1096 updating bookmarks
1096 updating bookmarks
1097
1097
1098 $ hg -R hgextras3 log --debug -r 1
1098 $ hg -R hgextras3 log --debug -r 1
1099 changeset: 1:0105af33379e7b6491501fd34141b7af700fe125
1099 changeset: 1:0105af33379e7b6491501fd34141b7af700fe125
1100 bookmark: master
1100 bookmark: master
1101 tag: tip
1101 tag: tip
1102 phase: draft
1102 phase: draft
1103 parent: 0:dcb68977c55cd02cbd13b901df65c4b6e7b9c4b9
1103 parent: 0:dcb68977c55cd02cbd13b901df65c4b6e7b9c4b9
1104 parent: -1:0000000000000000000000000000000000000000
1104 parent: -1:0000000000000000000000000000000000000000
1105 manifest: 0:6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50
1105 manifest: 0:6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50
1106 user: test <test@example.com>
1106 user: test <test@example.com>
1107 date: Sun Sep 09 01:46:40 2001 +0000
1107 date: Sun Sep 09 01:46:40 2001 +0000
1108 extra: branch=default
1108 extra: branch=default
1109 extra: convert_revision=8123727c8361a4117d1a2d80e0c4e7d70c757f18
1109 extra: convert_revision=8123727c8361a4117d1a2d80e0c4e7d70c757f18
1110 extra: extra-1=extra-1
1110 extra: extra-1=extra-1
1111 extra: extra-2=extra-2 with space
1111 extra: extra-2=extra-2 with space
1112 description:
1112 description:
1113 message with extras
1113 message with extras
1114
1114
1115
1115
1116
1116
1117 convert.git.saverev can be disabled to prevent convert_revision from being written
1117 convert.git.saverev can be disabled to prevent convert_revision from being written
1118
1118
1119 $ hg convert --config convert.git.saverev=false gitextras hgextras4
1119 $ hg convert --config convert.git.saverev=false gitextras hgextras4
1120 initializing destination hgextras4 repository
1120 initializing destination hgextras4 repository
1121 scanning source...
1121 scanning source...
1122 sorting...
1122 sorting...
1123 converting...
1123 converting...
1124 1 initial
1124 1 initial
1125 0 message with extras
1125 0 message with extras
1126 updating bookmarks
1126 updating bookmarks
1127
1127
1128 $ hg -R hgextras4 log --debug -r 1
1128 $ hg -R hgextras4 log --debug -r 1
1129 changeset: 1:1dcaf4ffe5bee43fa86db2800821f6f0af212c5c
1129 changeset: 1:1dcaf4ffe5bee43fa86db2800821f6f0af212c5c
1130 bookmark: master
1130 bookmark: master
1131 tag: tip
1131 tag: tip
1132 phase: draft
1132 phase: draft
1133 parent: 0:a13935fec4daf06a5a87a7307ccb0fc94f98d06d
1133 parent: 0:a13935fec4daf06a5a87a7307ccb0fc94f98d06d
1134 parent: -1:0000000000000000000000000000000000000000
1134 parent: -1:0000000000000000000000000000000000000000
1135 manifest: 0:6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50
1135 manifest: 0:6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50
1136 user: test <test@example.com>
1136 user: test <test@example.com>
1137 date: Sun Sep 09 01:46:40 2001 +0000
1137 date: Sun Sep 09 01:46:40 2001 +0000
1138 extra: branch=default
1138 extra: branch=default
1139 description:
1139 description:
1140 message with extras
1140 message with extras
1141
1141
1142
1142
1143
1143
1144 convert.git.saverev and convert.git.extrakeys can be combined to preserve
1144 convert.git.saverev and convert.git.extrakeys can be combined to preserve
1145 convert_revision from source
1145 convert_revision from source
1146
1146
1147 $ hg convert --config convert.git.saverev=false --config convert.git.extrakeys=convert_revision gitextras hgextras5
1147 $ hg convert --config convert.git.saverev=false --config convert.git.extrakeys=convert_revision gitextras hgextras5
1148 initializing destination hgextras5 repository
1148 initializing destination hgextras5 repository
1149 scanning source...
1149 scanning source...
1150 sorting...
1150 sorting...
1151 converting...
1151 converting...
1152 1 initial
1152 1 initial
1153 0 message with extras
1153 0 message with extras
1154 updating bookmarks
1154 updating bookmarks
1155
1155
1156 $ hg -R hgextras5 log --debug -r 1
1156 $ hg -R hgextras5 log --debug -r 1
1157 changeset: 1:574d85931544d4542007664fee3747360e85ee28
1157 changeset: 1:574d85931544d4542007664fee3747360e85ee28
1158 bookmark: master
1158 bookmark: master
1159 tag: tip
1159 tag: tip
1160 phase: draft
1160 phase: draft
1161 parent: 0:a13935fec4daf06a5a87a7307ccb0fc94f98d06d
1161 parent: 0:a13935fec4daf06a5a87a7307ccb0fc94f98d06d
1162 parent: -1:0000000000000000000000000000000000000000
1162 parent: -1:0000000000000000000000000000000000000000
1163 manifest: 0:6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50
1163 manifest: 0:6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50
1164 user: test <test@example.com>
1164 user: test <test@example.com>
1165 date: Sun Sep 09 01:46:40 2001 +0000
1165 date: Sun Sep 09 01:46:40 2001 +0000
1166 extra: branch=default
1166 extra: branch=default
1167 extra: convert_revision=0000aaaabbbbccccddddeeee
1167 extra: convert_revision=0000aaaabbbbccccddddeeee
1168 description:
1168 description:
1169 message with extras
1169 message with extras
1170
1170
1171
1171
General Comments 0
You need to be logged in to leave comments. Login now