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