Show More
@@ -1,347 +1,358 b'' | |||||
1 |
|
1 | |||
2 | $ "$TESTDIR/hghave" git || exit 80 |
|
2 | $ "$TESTDIR/hghave" git || exit 80 | |
3 | $ echo "[core]" >> $HOME/.gitconfig |
|
3 | $ echo "[core]" >> $HOME/.gitconfig | |
4 | $ echo "autocrlf = false" >> $HOME/.gitconfig |
|
4 | $ echo "autocrlf = false" >> $HOME/.gitconfig | |
5 | $ echo "[core]" >> $HOME/.gitconfig |
|
5 | $ echo "[core]" >> $HOME/.gitconfig | |
6 | $ echo "autocrlf = false" >> $HOME/.gitconfig |
|
6 | $ echo "autocrlf = false" >> $HOME/.gitconfig | |
7 | $ echo "[extensions]" >> $HGRCPATH |
|
7 | $ echo "[extensions]" >> $HGRCPATH | |
8 | $ echo "convert=" >> $HGRCPATH |
|
8 | $ echo "convert=" >> $HGRCPATH | |
9 | $ echo 'hgext.graphlog =' >> $HGRCPATH |
|
9 | $ echo 'hgext.graphlog =' >> $HGRCPATH | |
10 | $ GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME |
|
10 | $ GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME | |
11 | $ GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL |
|
11 | $ GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL | |
12 | $ GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0000"; export GIT_AUTHOR_DATE |
|
12 | $ GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0000"; export GIT_AUTHOR_DATE | |
13 | $ GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME |
|
13 | $ GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME | |
14 | $ GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL |
|
14 | $ GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL | |
15 | $ GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE |
|
15 | $ GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE | |
16 | $ count=10 |
|
16 | $ count=10 | |
17 | $ commit() |
|
17 | $ commit() | |
18 | > { |
|
18 | > { | |
19 | > GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000" |
|
19 | > GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000" | |
20 | > GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE" |
|
20 | > GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE" | |
21 | > git commit "$@" >/dev/null 2>/dev/null || echo "git commit error" |
|
21 | > git commit "$@" >/dev/null 2>/dev/null || echo "git commit error" | |
22 | > count=`expr $count + 1` |
|
22 | > count=`expr $count + 1` | |
23 | > } |
|
23 | > } | |
24 | $ mkdir git-repo |
|
24 | $ mkdir git-repo | |
25 | $ cd git-repo |
|
25 | $ cd git-repo | |
26 | $ git init-db >/dev/null 2>/dev/null |
|
26 | $ git init-db >/dev/null 2>/dev/null | |
27 | $ echo a > a |
|
27 | $ echo a > a | |
28 | $ mkdir d |
|
28 | $ mkdir d | |
29 | $ echo b > d/b |
|
29 | $ echo b > d/b | |
30 | $ git add a d |
|
30 | $ git add a d | |
31 | $ commit -a -m t1 |
|
31 | $ commit -a -m t1 | |
32 |
|
32 | |||
33 | Remove the directory, then try to replace it with a file |
|
33 | Remove the directory, then try to replace it with a file | |
34 | (issue 754) |
|
34 | (issue 754) | |
35 |
|
35 | |||
36 | $ git rm -f d/b |
|
36 | $ git rm -f d/b | |
37 | rm 'd/b' |
|
37 | rm 'd/b' | |
38 | $ commit -m t2 |
|
38 | $ commit -m t2 | |
39 | $ echo d > d |
|
39 | $ echo d > d | |
40 | $ git add d |
|
40 | $ git add d | |
41 | $ commit -m t3 |
|
41 | $ commit -m t3 | |
42 | $ echo b >> a |
|
42 | $ echo b >> a | |
43 | $ commit -a -m t4.1 |
|
43 | $ commit -a -m t4.1 | |
44 | $ git checkout -b other HEAD~ >/dev/null 2>/dev/null |
|
44 | $ git checkout -b other HEAD~ >/dev/null 2>/dev/null | |
45 | $ echo c > a |
|
45 | $ echo c > a | |
46 | $ echo a >> a |
|
46 | $ echo a >> a | |
47 | $ commit -a -m t4.2 |
|
47 | $ commit -a -m t4.2 | |
48 | $ git checkout master >/dev/null 2>/dev/null |
|
48 | $ git checkout master >/dev/null 2>/dev/null | |
49 | $ git pull --no-commit . other > /dev/null 2>/dev/null |
|
49 | $ git pull --no-commit . other > /dev/null 2>/dev/null | |
50 | $ commit -m 'Merge branch other' |
|
50 | $ commit -m 'Merge branch other' | |
51 | $ cd .. |
|
51 | $ cd .. | |
52 | $ hg convert --datesort git-repo |
|
52 | $ hg convert --datesort git-repo | |
53 | assuming destination git-repo-hg |
|
53 | assuming destination git-repo-hg | |
54 | initializing destination git-repo-hg repository |
|
54 | initializing destination git-repo-hg repository | |
55 | scanning source... |
|
55 | scanning source... | |
56 | sorting... |
|
56 | sorting... | |
57 | converting... |
|
57 | converting... | |
58 | 5 t1 |
|
58 | 5 t1 | |
59 | 4 t2 |
|
59 | 4 t2 | |
60 | 3 t3 |
|
60 | 3 t3 | |
61 | 2 t4.1 |
|
61 | 2 t4.1 | |
62 | 1 t4.2 |
|
62 | 1 t4.2 | |
63 | 0 Merge branch other |
|
63 | 0 Merge branch other | |
64 | updating bookmarks |
|
64 | updating bookmarks | |
65 | $ hg up -q -R git-repo-hg |
|
65 | $ hg up -q -R git-repo-hg | |
66 | $ hg -R git-repo-hg tip -v |
|
66 | $ hg -R git-repo-hg tip -v | |
67 | changeset: 5:c78094926be2 |
|
67 | changeset: 5:c78094926be2 | |
68 | bookmark: master |
|
68 | bookmark: master | |
69 | tag: tip |
|
69 | tag: tip | |
70 | parent: 3:f5f5cb45432b |
|
70 | parent: 3:f5f5cb45432b | |
71 | parent: 4:4e174f80c67c |
|
71 | parent: 4:4e174f80c67c | |
72 | user: test <test@example.org> |
|
72 | user: test <test@example.org> | |
73 | date: Mon Jan 01 00:00:15 2007 +0000 |
|
73 | date: Mon Jan 01 00:00:15 2007 +0000 | |
74 | files: a |
|
74 | files: a | |
75 | description: |
|
75 | description: | |
76 | Merge branch other |
|
76 | Merge branch other | |
77 |
|
77 | |||
78 |
|
78 | |||
79 | $ count=10 |
|
79 | $ count=10 | |
80 | $ mkdir git-repo2 |
|
80 | $ mkdir git-repo2 | |
81 | $ cd git-repo2 |
|
81 | $ cd git-repo2 | |
82 | $ git init-db >/dev/null 2>/dev/null |
|
82 | $ git init-db >/dev/null 2>/dev/null | |
83 | $ echo foo > foo |
|
83 | $ echo foo > foo | |
84 | $ git add foo |
|
84 | $ git add foo | |
85 | $ commit -a -m 'add foo' |
|
85 | $ commit -a -m 'add foo' | |
86 | $ echo >> foo |
|
86 | $ echo >> foo | |
87 | $ commit -a -m 'change foo' |
|
87 | $ commit -a -m 'change foo' | |
88 | $ git checkout -b Bar HEAD~ >/dev/null 2>/dev/null |
|
88 | $ git checkout -b Bar HEAD~ >/dev/null 2>/dev/null | |
89 | $ echo quux >> quux |
|
89 | $ echo quux >> quux | |
90 | $ git add quux |
|
90 | $ git add quux | |
91 | $ commit -a -m 'add quux' |
|
91 | $ commit -a -m 'add quux' | |
92 | $ echo bar > bar |
|
92 | $ echo bar > bar | |
93 | $ git add bar |
|
93 | $ git add bar | |
94 | $ commit -a -m 'add bar' |
|
94 | $ commit -a -m 'add bar' | |
95 | $ git checkout -b Baz HEAD~ >/dev/null 2>/dev/null |
|
95 | $ git checkout -b Baz HEAD~ >/dev/null 2>/dev/null | |
96 | $ echo baz > baz |
|
96 | $ echo baz > baz | |
97 | $ git add baz |
|
97 | $ git add baz | |
98 | $ commit -a -m 'add baz' |
|
98 | $ commit -a -m 'add baz' | |
99 | $ git checkout master >/dev/null 2>/dev/null |
|
99 | $ git checkout master >/dev/null 2>/dev/null | |
100 | $ git pull --no-commit . Bar Baz > /dev/null 2>/dev/null |
|
100 | $ git pull --no-commit . Bar Baz > /dev/null 2>/dev/null | |
101 | $ commit -m 'Octopus merge' |
|
101 | $ commit -m 'Octopus merge' | |
102 | $ echo bar >> bar |
|
102 | $ echo bar >> bar | |
103 | $ commit -a -m 'change bar' |
|
103 | $ commit -a -m 'change bar' | |
104 | $ git checkout -b Foo HEAD~ >/dev/null 2>/dev/null |
|
104 | $ git checkout -b Foo HEAD~ >/dev/null 2>/dev/null | |
105 | $ echo >> foo |
|
105 | $ echo >> foo | |
106 | $ commit -a -m 'change foo' |
|
106 | $ commit -a -m 'change foo' | |
107 | $ git checkout master >/dev/null 2>/dev/null |
|
107 | $ git checkout master >/dev/null 2>/dev/null | |
108 | $ git pull --no-commit -s ours . Foo > /dev/null 2>/dev/null |
|
108 | $ git pull --no-commit -s ours . Foo > /dev/null 2>/dev/null | |
109 | $ commit -m 'Discard change to foo' |
|
109 | $ commit -m 'Discard change to foo' | |
110 | $ cd .. |
|
110 | $ cd .. | |
111 | $ glog() |
|
111 | $ glog() | |
112 | > { |
|
112 | > { | |
113 | > hg glog --template '{rev} "{desc|firstline}" files: {files}\n' "$@" |
|
113 | > hg glog --template '{rev} "{desc|firstline}" files: {files}\n' "$@" | |
114 | > } |
|
114 | > } | |
115 | $ splitrepo() |
|
115 | $ splitrepo() | |
116 | > { |
|
116 | > { | |
117 | > msg="$1" |
|
117 | > msg="$1" | |
118 | > files="$2" |
|
118 | > files="$2" | |
119 | > opts=$3 |
|
119 | > opts=$3 | |
120 | > echo "% $files: $msg" |
|
120 | > echo "% $files: $msg" | |
121 | > prefix=`echo "$files" | sed -e 's/ /-/g'` |
|
121 | > prefix=`echo "$files" | sed -e 's/ /-/g'` | |
122 | > fmap="$prefix.fmap" |
|
122 | > fmap="$prefix.fmap" | |
123 | > repo="$prefix.repo" |
|
123 | > repo="$prefix.repo" | |
124 | > for i in $files; do |
|
124 | > for i in $files; do | |
125 | > echo "include $i" >> "$fmap" |
|
125 | > echo "include $i" >> "$fmap" | |
126 | > done |
|
126 | > done | |
127 | > hg -q convert $opts --filemap "$fmap" --datesort git-repo2 "$repo" |
|
127 | > hg -q convert $opts --filemap "$fmap" --datesort git-repo2 "$repo" | |
128 | > hg up -q -R "$repo" |
|
128 | > hg up -q -R "$repo" | |
129 | > glog -R "$repo" |
|
129 | > glog -R "$repo" | |
130 | > hg -R "$repo" manifest --debug |
|
130 | > hg -R "$repo" manifest --debug | |
131 | > } |
|
131 | > } | |
132 |
|
132 | |||
133 | full conversion |
|
133 | full conversion | |
134 |
|
134 | |||
135 | $ hg -q convert --datesort git-repo2 fullrepo |
|
135 | $ hg -q convert --datesort git-repo2 fullrepo | |
136 | $ hg up -q -R fullrepo |
|
136 | $ hg up -q -R fullrepo | |
137 | $ glog -R fullrepo |
|
137 | $ glog -R fullrepo | |
138 | @ 9 "Discard change to foo" files: foo |
|
138 | @ 9 "Discard change to foo" files: foo | |
139 | |\ |
|
139 | |\ | |
140 | | o 8 "change foo" files: foo |
|
140 | | o 8 "change foo" files: foo | |
141 | | | |
|
141 | | | | |
142 | o | 7 "change bar" files: bar |
|
142 | o | 7 "change bar" files: bar | |
143 | |/ |
|
143 | |/ | |
144 | o 6 "(octopus merge fixup)" files: |
|
144 | o 6 "(octopus merge fixup)" files: | |
145 | |\ |
|
145 | |\ | |
146 | | o 5 "Octopus merge" files: baz |
|
146 | | o 5 "Octopus merge" files: baz | |
147 | | |\ |
|
147 | | |\ | |
148 | o | | 4 "add baz" files: baz |
|
148 | o | | 4 "add baz" files: baz | |
149 | | | | |
|
149 | | | | | |
150 | +---o 3 "add bar" files: bar |
|
150 | +---o 3 "add bar" files: bar | |
151 | | | |
|
151 | | | | |
152 | o | 2 "add quux" files: quux |
|
152 | o | 2 "add quux" files: quux | |
153 | | | |
|
153 | | | | |
154 | | o 1 "change foo" files: foo |
|
154 | | o 1 "change foo" files: foo | |
155 | |/ |
|
155 | |/ | |
156 | o 0 "add foo" files: foo |
|
156 | o 0 "add foo" files: foo | |
157 |
|
157 | |||
158 | $ hg -R fullrepo manifest --debug |
|
158 | $ hg -R fullrepo manifest --debug | |
159 | 245a3b8bc653999c2b22cdabd517ccb47aecafdf 644 bar |
|
159 | 245a3b8bc653999c2b22cdabd517ccb47aecafdf 644 bar | |
160 | 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz |
|
160 | 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz | |
161 | 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo |
|
161 | 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo | |
162 | 88dfeab657e8cf2cef3dec67b914f49791ae76b1 644 quux |
|
162 | 88dfeab657e8cf2cef3dec67b914f49791ae76b1 644 quux | |
163 | $ splitrepo 'octopus merge' 'foo bar baz' |
|
163 | $ splitrepo 'octopus merge' 'foo bar baz' | |
164 | % foo bar baz: octopus merge |
|
164 | % foo bar baz: octopus merge | |
165 | @ 8 "Discard change to foo" files: foo |
|
165 | @ 8 "Discard change to foo" files: foo | |
166 | |\ |
|
166 | |\ | |
167 | | o 7 "change foo" files: foo |
|
167 | | o 7 "change foo" files: foo | |
168 | | | |
|
168 | | | | |
169 | o | 6 "change bar" files: bar |
|
169 | o | 6 "change bar" files: bar | |
170 | |/ |
|
170 | |/ | |
171 | o 5 "(octopus merge fixup)" files: |
|
171 | o 5 "(octopus merge fixup)" files: | |
172 | |\ |
|
172 | |\ | |
173 | | o 4 "Octopus merge" files: baz |
|
173 | | o 4 "Octopus merge" files: baz | |
174 | | |\ |
|
174 | | |\ | |
175 | o | | 3 "add baz" files: baz |
|
175 | o | | 3 "add baz" files: baz | |
176 | | | | |
|
176 | | | | | |
177 | +---o 2 "add bar" files: bar |
|
177 | +---o 2 "add bar" files: bar | |
178 | | | |
|
178 | | | | |
179 | | o 1 "change foo" files: foo |
|
179 | | o 1 "change foo" files: foo | |
180 | |/ |
|
180 | |/ | |
181 | o 0 "add foo" files: foo |
|
181 | o 0 "add foo" files: foo | |
182 |
|
182 | |||
183 | 245a3b8bc653999c2b22cdabd517ccb47aecafdf 644 bar |
|
183 | 245a3b8bc653999c2b22cdabd517ccb47aecafdf 644 bar | |
184 | 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz |
|
184 | 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz | |
185 | 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo |
|
185 | 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo | |
186 | $ splitrepo 'only some parents of an octopus merge; "discard" a head' 'foo baz quux' |
|
186 | $ splitrepo 'only some parents of an octopus merge; "discard" a head' 'foo baz quux' | |
187 | % foo baz quux: only some parents of an octopus merge; "discard" a head |
|
187 | % foo baz quux: only some parents of an octopus merge; "discard" a head | |
188 | @ 6 "Discard change to foo" files: foo |
|
188 | @ 6 "Discard change to foo" files: foo | |
189 | | |
|
189 | | | |
190 | o 5 "change foo" files: foo |
|
190 | o 5 "change foo" files: foo | |
191 | | |
|
191 | | | |
192 | o 4 "Octopus merge" files: |
|
192 | o 4 "Octopus merge" files: | |
193 | |\ |
|
193 | |\ | |
194 | | o 3 "add baz" files: baz |
|
194 | | o 3 "add baz" files: baz | |
195 | | | |
|
195 | | | | |
196 | | o 2 "add quux" files: quux |
|
196 | | o 2 "add quux" files: quux | |
197 | | | |
|
197 | | | | |
198 | o | 1 "change foo" files: foo |
|
198 | o | 1 "change foo" files: foo | |
199 | |/ |
|
199 | |/ | |
200 | o 0 "add foo" files: foo |
|
200 | o 0 "add foo" files: foo | |
201 |
|
201 | |||
202 | 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz |
|
202 | 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz | |
203 | 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo |
|
203 | 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo | |
204 | 88dfeab657e8cf2cef3dec67b914f49791ae76b1 644 quux |
|
204 | 88dfeab657e8cf2cef3dec67b914f49791ae76b1 644 quux | |
205 |
|
205 | |||
206 | test binary conversion (issue 1359) |
|
206 | test binary conversion (issue 1359) | |
207 |
|
207 | |||
208 | $ mkdir git-repo3 |
|
208 | $ mkdir git-repo3 | |
209 | $ cd git-repo3 |
|
209 | $ cd git-repo3 | |
210 | $ git init-db >/dev/null 2>/dev/null |
|
210 | $ git init-db >/dev/null 2>/dev/null | |
211 | $ python -c 'file("b", "wb").write("".join([chr(i) for i in range(256)])*16)' |
|
211 | $ python -c 'file("b", "wb").write("".join([chr(i) for i in range(256)])*16)' | |
212 | $ git add b |
|
212 | $ git add b | |
213 | $ commit -a -m addbinary |
|
213 | $ commit -a -m addbinary | |
214 | $ cd .. |
|
214 | $ cd .. | |
215 |
|
215 | |||
216 | convert binary file |
|
216 | convert binary file | |
217 |
|
217 | |||
218 | $ hg convert git-repo3 git-repo3-hg |
|
218 | $ hg convert git-repo3 git-repo3-hg | |
219 | initializing destination git-repo3-hg repository |
|
219 | initializing destination git-repo3-hg repository | |
220 | scanning source... |
|
220 | scanning source... | |
221 | sorting... |
|
221 | sorting... | |
222 | converting... |
|
222 | converting... | |
223 | 0 addbinary |
|
223 | 0 addbinary | |
224 | updating bookmarks |
|
224 | updating bookmarks | |
225 | $ cd git-repo3-hg |
|
225 | $ cd git-repo3-hg | |
226 | $ hg up -C |
|
226 | $ hg up -C | |
227 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
227 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
228 | $ python -c 'print len(file("b", "rb").read())' |
|
228 | $ python -c 'print len(file("b", "rb").read())' | |
229 | 4096 |
|
229 | 4096 | |
230 | $ cd .. |
|
230 | $ cd .. | |
231 |
|
231 | |||
232 | test author vs committer |
|
232 | test author vs committer | |
233 |
|
233 | |||
234 | $ mkdir git-repo4 |
|
234 | $ mkdir git-repo4 | |
235 | $ cd git-repo4 |
|
235 | $ cd git-repo4 | |
236 | $ git init-db >/dev/null 2>/dev/null |
|
236 | $ git init-db >/dev/null 2>/dev/null | |
237 | $ echo >> foo |
|
237 | $ echo >> foo | |
238 | $ git add foo |
|
238 | $ git add foo | |
239 | $ commit -a -m addfoo |
|
239 | $ commit -a -m addfoo | |
240 | $ echo >> foo |
|
240 | $ echo >> foo | |
241 | $ GIT_AUTHOR_NAME="nottest" |
|
241 | $ GIT_AUTHOR_NAME="nottest" | |
242 | $ commit -a -m addfoo2 |
|
242 | $ commit -a -m addfoo2 | |
243 | $ cd .. |
|
243 | $ cd .. | |
244 |
|
244 | |||
245 | convert author committer |
|
245 | convert author committer | |
246 |
|
246 | |||
247 | $ hg convert git-repo4 git-repo4-hg |
|
247 | $ hg convert git-repo4 git-repo4-hg | |
248 | initializing destination git-repo4-hg repository |
|
248 | initializing destination git-repo4-hg repository | |
249 | scanning source... |
|
249 | scanning source... | |
250 | sorting... |
|
250 | sorting... | |
251 | converting... |
|
251 | converting... | |
252 | 1 addfoo |
|
252 | 1 addfoo | |
253 | 0 addfoo2 |
|
253 | 0 addfoo2 | |
254 | updating bookmarks |
|
254 | updating bookmarks | |
255 | $ hg -R git-repo4-hg log -v |
|
255 | $ hg -R git-repo4-hg log -v | |
256 | changeset: 1:d63e967f93da |
|
256 | changeset: 1:d63e967f93da | |
257 | bookmark: master |
|
257 | bookmark: master | |
258 | tag: tip |
|
258 | tag: tip | |
259 | user: nottest <test@example.org> |
|
259 | user: nottest <test@example.org> | |
260 | date: Mon Jan 01 00:00:21 2007 +0000 |
|
260 | date: Mon Jan 01 00:00:21 2007 +0000 | |
261 | files: foo |
|
261 | files: foo | |
262 | description: |
|
262 | description: | |
263 | addfoo2 |
|
263 | addfoo2 | |
264 |
|
264 | |||
265 | committer: test <test@example.org> |
|
265 | committer: test <test@example.org> | |
266 |
|
266 | |||
267 |
|
267 | |||
268 | changeset: 0:0735477b0224 |
|
268 | changeset: 0:0735477b0224 | |
269 | user: test <test@example.org> |
|
269 | user: test <test@example.org> | |
270 | date: Mon Jan 01 00:00:20 2007 +0000 |
|
270 | date: Mon Jan 01 00:00:20 2007 +0000 | |
271 | files: foo |
|
271 | files: foo | |
272 | description: |
|
272 | description: | |
273 | addfoo |
|
273 | addfoo | |
274 |
|
274 | |||
275 |
|
275 | |||
276 |
|
276 | |||
277 | --sourceorder should fail |
|
277 | --sourceorder should fail | |
278 |
|
278 | |||
279 | $ hg convert --sourcesort git-repo4 git-repo4-sourcesort-hg |
|
279 | $ hg convert --sourcesort git-repo4 git-repo4-sourcesort-hg | |
280 | initializing destination git-repo4-sourcesort-hg repository |
|
280 | initializing destination git-repo4-sourcesort-hg repository | |
281 | abort: --sourcesort is not supported by this data source |
|
281 | abort: --sourcesort is not supported by this data source | |
282 | [255] |
|
282 | [255] | |
283 |
|
283 | |||
284 | damage git repository and convert again |
|
|||
285 |
|
||||
286 | $ cat > damage.py <<EOF |
|
|||
287 | > import os |
|
|||
288 | > import stat |
|
|||
289 | > for root, dirs, files in os.walk('git-repo4/.git/objects'): |
|
|||
290 | > if files: |
|
|||
291 | > path = os.path.join(root, files[0]) |
|
|||
292 | > if os.name == 'nt': |
|
|||
293 | > os.chmod(path, stat.S_IWUSR) |
|
|||
294 | > os.remove(path) |
|
|||
295 | > break |
|
|||
296 | > EOF |
|
|||
297 | $ python damage.py |
|
|||
298 | $ hg convert git-repo4 git-repo4-broken-hg 2>&1 | \ |
|
|||
299 | > grep 'abort:' | sed 's/abort:.*/abort:/g' |
|
|||
300 | abort: |
|
|||
301 |
|
||||
302 | test sub modules |
|
284 | test sub modules | |
303 |
|
285 | |||
304 | $ mkdir git-repo5 |
|
286 | $ mkdir git-repo5 | |
305 | $ cd git-repo5 |
|
287 | $ cd git-repo5 | |
306 | $ git init-db >/dev/null 2>/dev/null |
|
288 | $ git init-db >/dev/null 2>/dev/null | |
307 | $ echo 'sub' >> foo |
|
289 | $ echo 'sub' >> foo | |
308 | $ git add foo |
|
290 | $ git add foo | |
309 | $ commit -a -m 'addfoo' |
|
291 | $ commit -a -m 'addfoo' | |
310 | $ BASE=`pwd` |
|
292 | $ BASE=`pwd` | |
311 | $ cd .. |
|
293 | $ cd .. | |
312 | $ mkdir git-repo6 |
|
294 | $ mkdir git-repo6 | |
313 | $ cd git-repo6 |
|
295 | $ cd git-repo6 | |
314 | $ git init-db >/dev/null 2>/dev/null |
|
296 | $ git init-db >/dev/null 2>/dev/null | |
315 | $ git submodule add ${BASE} >/dev/null 2>/dev/null |
|
297 | $ git submodule add ${BASE} >/dev/null 2>/dev/null | |
316 | $ commit -a -m 'addsubmodule' >/dev/null 2>/dev/null |
|
298 | $ commit -a -m 'addsubmodule' >/dev/null 2>/dev/null | |
317 | $ cd .. |
|
299 | $ cd .. | |
318 |
|
300 | |||
319 | convert sub modules |
|
301 | convert sub modules | |
320 | $ hg convert git-repo6 git-repo6-hg |
|
302 | $ hg convert git-repo6 git-repo6-hg | |
321 | initializing destination git-repo6-hg repository |
|
303 | initializing destination git-repo6-hg repository | |
322 | scanning source... |
|
304 | scanning source... | |
323 | sorting... |
|
305 | sorting... | |
324 | converting... |
|
306 | converting... | |
325 | 0 addsubmodule |
|
307 | 0 addsubmodule | |
326 | updating bookmarks |
|
308 | updating bookmarks | |
327 | $ hg -R git-repo6-hg log -v |
|
309 | $ hg -R git-repo6-hg log -v | |
328 | changeset: 0:* (glob) |
|
310 | changeset: 0:* (glob) | |
329 | bookmark: master |
|
311 | bookmark: master | |
330 | tag: tip |
|
312 | tag: tip | |
331 | user: nottest <test@example.org> |
|
313 | user: nottest <test@example.org> | |
332 | date: Mon Jan 01 00:00:23 2007 +0000 |
|
314 | date: Mon Jan 01 00:00:23 2007 +0000 | |
333 | files: .hgsub .hgsubstate |
|
315 | files: .hgsub .hgsubstate | |
334 | description: |
|
316 | description: | |
335 | addsubmodule |
|
317 | addsubmodule | |
336 |
|
318 | |||
337 | committer: test <test@example.org> |
|
319 | committer: test <test@example.org> | |
338 |
|
320 | |||
339 |
|
321 | |||
340 |
|
322 | |||
341 | $ cd git-repo6-hg |
|
323 | $ cd git-repo6-hg | |
342 | $ hg up >/dev/null 2>/dev/null |
|
324 | $ hg up >/dev/null 2>/dev/null | |
343 | $ cat .hgsubstate |
|
325 | $ cat .hgsubstate | |
344 | * git-repo5 (glob) |
|
326 | * git-repo5 (glob) | |
345 | $ cd git-repo5 |
|
327 | $ cd git-repo5 | |
346 | $ cat foo |
|
328 | $ cat foo | |
347 | sub |
|
329 | sub | |
|
330 | ||||
|
331 | $ cd ../.. | |||
|
332 | ||||
|
333 | damaged git repository tests: | |||
|
334 | In case the hard-coded hashes change, the following commands can be used to | |||
|
335 | list the hashes and their corresponding types in the repository: | |||
|
336 | cd git-repo4/.git/objects | |||
|
337 | find . -type f | cut -c 3- | sed 's_/__' | xargs -n 1 -t git cat-file -t | |||
|
338 | cd ../../.. | |||
|
339 | ||||
|
340 | damage git repository by renaming a commit object | |||
|
341 | $ COMMIT_OBJ=1c/0ce3c5886f83a1d78a7b517cdff5cf9ca17bdd | |||
|
342 | $ mv git-repo4/.git/objects/$COMMIT_OBJ git-repo4/.git/objects/$COMMIT_OBJ.tmp | |||
|
343 | $ hg convert git-repo4 git-repo4-broken-hg 2>&1 | grep 'abort:' | |||
|
344 | abort: cannot read tags from git-repo4/.git | |||
|
345 | $ mv git-repo4/.git/objects/$COMMIT_OBJ.tmp git-repo4/.git/objects/$COMMIT_OBJ | |||
|
346 | damage git repository by renaming a blob object | |||
|
347 | ||||
|
348 | $ BLOB_OBJ=8b/137891791fe96927ad78e64b0aad7bded08bdc | |||
|
349 | $ mv git-repo4/.git/objects/$BLOB_OBJ git-repo4/.git/objects/$BLOB_OBJ.tmp | |||
|
350 | $ hg convert git-repo4 git-repo4-broken-hg 2>&1 | grep 'abort:' | |||
|
351 | abort: cannot read 'blob' object at 8b137891791fe96927ad78e64b0aad7bded08bdc | |||
|
352 | $ mv git-repo4/.git/objects/$BLOB_OBJ.tmp git-repo4/.git/objects/$BLOB_OBJ | |||
|
353 | damage git repository by renaming a tree object | |||
|
354 | ||||
|
355 | $ TREE_OBJ=72/49f083d2a63a41cc737764a86981eb5f3e4635 | |||
|
356 | $ mv git-repo4/.git/objects/$TREE_OBJ git-repo4/.git/objects/$TREE_OBJ.tmp | |||
|
357 | $ hg convert git-repo4 git-repo4-broken-hg 2>&1 | grep 'abort:' | |||
|
358 | abort: cannot read changes in 1c0ce3c5886f83a1d78a7b517cdff5cf9ca17bdd |
General Comments 0
You need to be logged in to leave comments.
Login now