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