Show More
@@ -1,293 +1,295 b'' | |||||
1 |
|
1 | |||
2 | $ "$TESTDIR/hghave" git || exit 80 |
|
2 | $ "$TESTDIR/hghave" git || exit 80 | |
|
3 | $ echo "[core]" >> $HOME/.gitconfig | |||
|
4 | $ echo "autocrlf = false" >> $HOME/.gitconfig | |||
3 | $ echo "[extensions]" >> $HGRCPATH |
|
5 | $ echo "[extensions]" >> $HGRCPATH | |
4 | $ echo "convert=" >> $HGRCPATH |
|
6 | $ echo "convert=" >> $HGRCPATH | |
5 | $ echo 'hgext.graphlog =' >> $HGRCPATH |
|
7 | $ echo 'hgext.graphlog =' >> $HGRCPATH | |
6 | $ GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME |
|
8 | $ GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME | |
7 | $ GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL |
|
9 | $ GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL | |
8 | $ GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0000"; export GIT_AUTHOR_DATE |
|
10 | $ GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0000"; export GIT_AUTHOR_DATE | |
9 | $ GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME |
|
11 | $ GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME | |
10 | $ GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL |
|
12 | $ GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL | |
11 | $ GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE |
|
13 | $ GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE | |
12 | $ count=10 |
|
14 | $ count=10 | |
13 | $ commit() |
|
15 | $ commit() | |
14 | > { |
|
16 | > { | |
15 | > GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000" |
|
17 | > GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000" | |
16 | > GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE" |
|
18 | > GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE" | |
17 | > git commit "$@" >/dev/null 2>/dev/null || echo "git commit error" |
|
19 | > git commit "$@" >/dev/null 2>/dev/null || echo "git commit error" | |
18 | > count=`expr $count + 1` |
|
20 | > count=`expr $count + 1` | |
19 | > } |
|
21 | > } | |
20 | $ mkdir git-repo |
|
22 | $ mkdir git-repo | |
21 | $ cd git-repo |
|
23 | $ cd git-repo | |
22 | $ git init-db >/dev/null 2>/dev/null |
|
24 | $ git init-db >/dev/null 2>/dev/null | |
23 | $ echo a > a |
|
25 | $ echo a > a | |
24 | $ mkdir d |
|
26 | $ mkdir d | |
25 | $ echo b > d/b |
|
27 | $ echo b > d/b | |
26 | $ git add a d |
|
28 | $ git add a d | |
27 | $ commit -a -m t1 |
|
29 | $ commit -a -m t1 | |
28 |
|
30 | |||
29 | Remove the directory, then try to replace it with a file |
|
31 | Remove the directory, then try to replace it with a file | |
30 | (issue 754) |
|
32 | (issue 754) | |
31 |
|
33 | |||
32 | $ git rm -f d/b |
|
34 | $ git rm -f d/b | |
33 | rm 'd/b' |
|
35 | rm 'd/b' | |
34 | $ commit -m t2 |
|
36 | $ commit -m t2 | |
35 | $ echo d > d |
|
37 | $ echo d > d | |
36 | $ git add d |
|
38 | $ git add d | |
37 | $ commit -m t3 |
|
39 | $ commit -m t3 | |
38 | $ echo b >> a |
|
40 | $ echo b >> a | |
39 | $ commit -a -m t4.1 |
|
41 | $ commit -a -m t4.1 | |
40 | $ git checkout -b other HEAD~ >/dev/null 2>/dev/null |
|
42 | $ git checkout -b other HEAD~ >/dev/null 2>/dev/null | |
41 | $ echo c > a |
|
43 | $ echo c > a | |
42 | $ echo a >> a |
|
44 | $ echo a >> a | |
43 | $ commit -a -m t4.2 |
|
45 | $ commit -a -m t4.2 | |
44 | $ git checkout master >/dev/null 2>/dev/null |
|
46 | $ git checkout master >/dev/null 2>/dev/null | |
45 | $ git pull --no-commit . other > /dev/null 2>/dev/null |
|
47 | $ git pull --no-commit . other > /dev/null 2>/dev/null | |
46 | $ commit -m 'Merge branch other' |
|
48 | $ commit -m 'Merge branch other' | |
47 | $ cd .. |
|
49 | $ cd .. | |
48 | $ hg convert --datesort git-repo |
|
50 | $ hg convert --datesort git-repo | |
49 | assuming destination git-repo-hg |
|
51 | assuming destination git-repo-hg | |
50 | initializing destination git-repo-hg repository |
|
52 | initializing destination git-repo-hg repository | |
51 | scanning source... |
|
53 | scanning source... | |
52 | sorting... |
|
54 | sorting... | |
53 | converting... |
|
55 | converting... | |
54 | 5 t1 |
|
56 | 5 t1 | |
55 | 4 t2 |
|
57 | 4 t2 | |
56 | 3 t3 |
|
58 | 3 t3 | |
57 | 2 t4.1 |
|
59 | 2 t4.1 | |
58 | 1 t4.2 |
|
60 | 1 t4.2 | |
59 | 0 Merge branch other |
|
61 | 0 Merge branch other | |
60 | updating bookmarks |
|
62 | updating bookmarks | |
61 | $ hg up -q -R git-repo-hg |
|
63 | $ hg up -q -R git-repo-hg | |
62 | $ hg -R git-repo-hg tip -v |
|
64 | $ hg -R git-repo-hg tip -v | |
63 | changeset: 5:c78094926be2 |
|
65 | changeset: 5:c78094926be2 | |
64 | bookmark: master |
|
66 | bookmark: master | |
65 | tag: tip |
|
67 | tag: tip | |
66 | parent: 3:f5f5cb45432b |
|
68 | parent: 3:f5f5cb45432b | |
67 | parent: 4:4e174f80c67c |
|
69 | parent: 4:4e174f80c67c | |
68 | user: test <test@example.org> |
|
70 | user: test <test@example.org> | |
69 | date: Mon Jan 01 00:00:15 2007 +0000 |
|
71 | date: Mon Jan 01 00:00:15 2007 +0000 | |
70 | files: a |
|
72 | files: a | |
71 | description: |
|
73 | description: | |
72 | Merge branch other |
|
74 | Merge branch other | |
73 |
|
75 | |||
74 |
|
76 | |||
75 | $ count=10 |
|
77 | $ count=10 | |
76 | $ mkdir git-repo2 |
|
78 | $ mkdir git-repo2 | |
77 | $ cd git-repo2 |
|
79 | $ cd git-repo2 | |
78 | $ git init-db >/dev/null 2>/dev/null |
|
80 | $ git init-db >/dev/null 2>/dev/null | |
79 | $ echo foo > foo |
|
81 | $ echo foo > foo | |
80 | $ git add foo |
|
82 | $ git add foo | |
81 | $ commit -a -m 'add foo' |
|
83 | $ commit -a -m 'add foo' | |
82 | $ echo >> foo |
|
84 | $ echo >> foo | |
83 | $ commit -a -m 'change foo' |
|
85 | $ commit -a -m 'change foo' | |
84 | $ git checkout -b Bar HEAD~ >/dev/null 2>/dev/null |
|
86 | $ git checkout -b Bar HEAD~ >/dev/null 2>/dev/null | |
85 | $ echo quux >> quux |
|
87 | $ echo quux >> quux | |
86 | $ git add quux |
|
88 | $ git add quux | |
87 | $ commit -a -m 'add quux' |
|
89 | $ commit -a -m 'add quux' | |
88 | $ echo bar > bar |
|
90 | $ echo bar > bar | |
89 | $ git add bar |
|
91 | $ git add bar | |
90 | $ commit -a -m 'add bar' |
|
92 | $ commit -a -m 'add bar' | |
91 | $ git checkout -b Baz HEAD~ >/dev/null 2>/dev/null |
|
93 | $ git checkout -b Baz HEAD~ >/dev/null 2>/dev/null | |
92 | $ echo baz > baz |
|
94 | $ echo baz > baz | |
93 | $ git add baz |
|
95 | $ git add baz | |
94 | $ commit -a -m 'add baz' |
|
96 | $ commit -a -m 'add baz' | |
95 | $ git checkout master >/dev/null 2>/dev/null |
|
97 | $ git checkout master >/dev/null 2>/dev/null | |
96 | $ git pull --no-commit . Bar Baz > /dev/null 2>/dev/null |
|
98 | $ git pull --no-commit . Bar Baz > /dev/null 2>/dev/null | |
97 | $ commit -m 'Octopus merge' |
|
99 | $ commit -m 'Octopus merge' | |
98 | $ echo bar >> bar |
|
100 | $ echo bar >> bar | |
99 | $ commit -a -m 'change bar' |
|
101 | $ commit -a -m 'change bar' | |
100 | $ git checkout -b Foo HEAD~ >/dev/null 2>/dev/null |
|
102 | $ git checkout -b Foo HEAD~ >/dev/null 2>/dev/null | |
101 | $ echo >> foo |
|
103 | $ echo >> foo | |
102 | $ commit -a -m 'change foo' |
|
104 | $ commit -a -m 'change foo' | |
103 | $ git checkout master >/dev/null 2>/dev/null |
|
105 | $ git checkout master >/dev/null 2>/dev/null | |
104 | $ git pull --no-commit -s ours . Foo > /dev/null 2>/dev/null |
|
106 | $ git pull --no-commit -s ours . Foo > /dev/null 2>/dev/null | |
105 | $ commit -m 'Discard change to foo' |
|
107 | $ commit -m 'Discard change to foo' | |
106 | $ cd .. |
|
108 | $ cd .. | |
107 | $ glog() |
|
109 | $ glog() | |
108 | > { |
|
110 | > { | |
109 | > hg glog --template '{rev} "{desc|firstline}" files: {files}\n' "$@" |
|
111 | > hg glog --template '{rev} "{desc|firstline}" files: {files}\n' "$@" | |
110 | > } |
|
112 | > } | |
111 | $ splitrepo() |
|
113 | $ splitrepo() | |
112 | > { |
|
114 | > { | |
113 | > msg="$1" |
|
115 | > msg="$1" | |
114 | > files="$2" |
|
116 | > files="$2" | |
115 | > opts=$3 |
|
117 | > opts=$3 | |
116 | > echo "% $files: $msg" |
|
118 | > echo "% $files: $msg" | |
117 | > prefix=`echo "$files" | sed -e 's/ /-/g'` |
|
119 | > prefix=`echo "$files" | sed -e 's/ /-/g'` | |
118 | > fmap="$prefix.fmap" |
|
120 | > fmap="$prefix.fmap" | |
119 | > repo="$prefix.repo" |
|
121 | > repo="$prefix.repo" | |
120 | > for i in $files; do |
|
122 | > for i in $files; do | |
121 | > echo "include $i" >> "$fmap" |
|
123 | > echo "include $i" >> "$fmap" | |
122 | > done |
|
124 | > done | |
123 | > hg -q convert $opts --filemap "$fmap" --datesort git-repo2 "$repo" |
|
125 | > hg -q convert $opts --filemap "$fmap" --datesort git-repo2 "$repo" | |
124 | > hg up -q -R "$repo" |
|
126 | > hg up -q -R "$repo" | |
125 | > glog -R "$repo" |
|
127 | > glog -R "$repo" | |
126 | > hg -R "$repo" manifest --debug |
|
128 | > hg -R "$repo" manifest --debug | |
127 | > } |
|
129 | > } | |
128 |
|
130 | |||
129 | full conversion |
|
131 | full conversion | |
130 |
|
132 | |||
131 | $ hg -q convert --datesort git-repo2 fullrepo |
|
133 | $ hg -q convert --datesort git-repo2 fullrepo | |
132 | $ hg up -q -R fullrepo |
|
134 | $ hg up -q -R fullrepo | |
133 | $ glog -R fullrepo |
|
135 | $ glog -R fullrepo | |
134 | @ 9 "Discard change to foo" files: foo |
|
136 | @ 9 "Discard change to foo" files: foo | |
135 | |\ |
|
137 | |\ | |
136 | | o 8 "change foo" files: foo |
|
138 | | o 8 "change foo" files: foo | |
137 | | | |
|
139 | | | | |
138 | o | 7 "change bar" files: bar |
|
140 | o | 7 "change bar" files: bar | |
139 | |/ |
|
141 | |/ | |
140 | o 6 "(octopus merge fixup)" files: |
|
142 | o 6 "(octopus merge fixup)" files: | |
141 | |\ |
|
143 | |\ | |
142 | | o 5 "Octopus merge" files: baz |
|
144 | | o 5 "Octopus merge" files: baz | |
143 | | |\ |
|
145 | | |\ | |
144 | o | | 4 "add baz" files: baz |
|
146 | o | | 4 "add baz" files: baz | |
145 | | | | |
|
147 | | | | | |
146 | +---o 3 "add bar" files: bar |
|
148 | +---o 3 "add bar" files: bar | |
147 | | | |
|
149 | | | | |
148 | o | 2 "add quux" files: quux |
|
150 | o | 2 "add quux" files: quux | |
149 | | | |
|
151 | | | | |
150 | | o 1 "change foo" files: foo |
|
152 | | o 1 "change foo" files: foo | |
151 | |/ |
|
153 | |/ | |
152 | o 0 "add foo" files: foo |
|
154 | o 0 "add foo" files: foo | |
153 |
|
155 | |||
154 | $ hg -R fullrepo manifest --debug |
|
156 | $ hg -R fullrepo manifest --debug | |
155 | 245a3b8bc653999c2b22cdabd517ccb47aecafdf 644 bar |
|
157 | 245a3b8bc653999c2b22cdabd517ccb47aecafdf 644 bar | |
156 | 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz |
|
158 | 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz | |
157 | 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo |
|
159 | 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo | |
158 | 88dfeab657e8cf2cef3dec67b914f49791ae76b1 644 quux |
|
160 | 88dfeab657e8cf2cef3dec67b914f49791ae76b1 644 quux | |
159 | $ splitrepo 'octopus merge' 'foo bar baz' |
|
161 | $ splitrepo 'octopus merge' 'foo bar baz' | |
160 | % foo bar baz: octopus merge |
|
162 | % foo bar baz: octopus merge | |
161 | @ 8 "Discard change to foo" files: foo |
|
163 | @ 8 "Discard change to foo" files: foo | |
162 | |\ |
|
164 | |\ | |
163 | | o 7 "change foo" files: foo |
|
165 | | o 7 "change foo" files: foo | |
164 | | | |
|
166 | | | | |
165 | o | 6 "change bar" files: bar |
|
167 | o | 6 "change bar" files: bar | |
166 | |/ |
|
168 | |/ | |
167 | o 5 "(octopus merge fixup)" files: |
|
169 | o 5 "(octopus merge fixup)" files: | |
168 | |\ |
|
170 | |\ | |
169 | | o 4 "Octopus merge" files: baz |
|
171 | | o 4 "Octopus merge" files: baz | |
170 | | |\ |
|
172 | | |\ | |
171 | o | | 3 "add baz" files: baz |
|
173 | o | | 3 "add baz" files: baz | |
172 | | | | |
|
174 | | | | | |
173 | +---o 2 "add bar" files: bar |
|
175 | +---o 2 "add bar" files: bar | |
174 | | | |
|
176 | | | | |
175 | | o 1 "change foo" files: foo |
|
177 | | o 1 "change foo" files: foo | |
176 | |/ |
|
178 | |/ | |
177 | o 0 "add foo" files: foo |
|
179 | o 0 "add foo" files: foo | |
178 |
|
180 | |||
179 | 245a3b8bc653999c2b22cdabd517ccb47aecafdf 644 bar |
|
181 | 245a3b8bc653999c2b22cdabd517ccb47aecafdf 644 bar | |
180 | 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz |
|
182 | 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz | |
181 | 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo |
|
183 | 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo | |
182 | $ splitrepo 'only some parents of an octopus merge; "discard" a head' 'foo baz quux' |
|
184 | $ splitrepo 'only some parents of an octopus merge; "discard" a head' 'foo baz quux' | |
183 | % foo baz quux: only some parents of an octopus merge; "discard" a head |
|
185 | % foo baz quux: only some parents of an octopus merge; "discard" a head | |
184 | @ 6 "Discard change to foo" files: foo |
|
186 | @ 6 "Discard change to foo" files: foo | |
185 | | |
|
187 | | | |
186 | o 5 "change foo" files: foo |
|
188 | o 5 "change foo" files: foo | |
187 | | |
|
189 | | | |
188 | o 4 "Octopus merge" files: |
|
190 | o 4 "Octopus merge" files: | |
189 | |\ |
|
191 | |\ | |
190 | | o 3 "add baz" files: baz |
|
192 | | o 3 "add baz" files: baz | |
191 | | | |
|
193 | | | | |
192 | | o 2 "add quux" files: quux |
|
194 | | o 2 "add quux" files: quux | |
193 | | | |
|
195 | | | | |
194 | o | 1 "change foo" files: foo |
|
196 | o | 1 "change foo" files: foo | |
195 | |/ |
|
197 | |/ | |
196 | o 0 "add foo" files: foo |
|
198 | o 0 "add foo" files: foo | |
197 |
|
199 | |||
198 | 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz |
|
200 | 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz | |
199 | 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo |
|
201 | 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo | |
200 | 88dfeab657e8cf2cef3dec67b914f49791ae76b1 644 quux |
|
202 | 88dfeab657e8cf2cef3dec67b914f49791ae76b1 644 quux | |
201 |
|
203 | |||
202 | test binary conversion (issue 1359) |
|
204 | test binary conversion (issue 1359) | |
203 |
|
205 | |||
204 | $ mkdir git-repo3 |
|
206 | $ mkdir git-repo3 | |
205 | $ cd git-repo3 |
|
207 | $ cd git-repo3 | |
206 | $ git init-db >/dev/null 2>/dev/null |
|
208 | $ git init-db >/dev/null 2>/dev/null | |
207 | $ python -c 'file("b", "wb").write("".join([chr(i) for i in range(256)])*16)' |
|
209 | $ python -c 'file("b", "wb").write("".join([chr(i) for i in range(256)])*16)' | |
208 | $ git add b |
|
210 | $ git add b | |
209 | $ commit -a -m addbinary |
|
211 | $ commit -a -m addbinary | |
210 | $ cd .. |
|
212 | $ cd .. | |
211 |
|
213 | |||
212 | convert binary file |
|
214 | convert binary file | |
213 |
|
215 | |||
214 | $ hg convert git-repo3 git-repo3-hg |
|
216 | $ hg convert git-repo3 git-repo3-hg | |
215 | initializing destination git-repo3-hg repository |
|
217 | initializing destination git-repo3-hg repository | |
216 | scanning source... |
|
218 | scanning source... | |
217 | sorting... |
|
219 | sorting... | |
218 | converting... |
|
220 | converting... | |
219 | 0 addbinary |
|
221 | 0 addbinary | |
220 | updating bookmarks |
|
222 | updating bookmarks | |
221 | $ cd git-repo3-hg |
|
223 | $ cd git-repo3-hg | |
222 | $ hg up -C |
|
224 | $ hg up -C | |
223 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
225 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
224 | $ python -c 'print len(file("b", "rb").read())' |
|
226 | $ python -c 'print len(file("b", "rb").read())' | |
225 | 4096 |
|
227 | 4096 | |
226 | $ cd .. |
|
228 | $ cd .. | |
227 |
|
229 | |||
228 | test author vs committer |
|
230 | test author vs committer | |
229 |
|
231 | |||
230 | $ mkdir git-repo4 |
|
232 | $ mkdir git-repo4 | |
231 | $ cd git-repo4 |
|
233 | $ cd git-repo4 | |
232 | $ git init-db >/dev/null 2>/dev/null |
|
234 | $ git init-db >/dev/null 2>/dev/null | |
233 | $ echo >> foo |
|
235 | $ echo >> foo | |
234 | $ git add foo |
|
236 | $ git add foo | |
235 | $ commit -a -m addfoo |
|
237 | $ commit -a -m addfoo | |
236 | $ echo >> foo |
|
238 | $ echo >> foo | |
237 | $ GIT_AUTHOR_NAME="nottest" |
|
239 | $ GIT_AUTHOR_NAME="nottest" | |
238 | $ commit -a -m addfoo2 |
|
240 | $ commit -a -m addfoo2 | |
239 | $ cd .. |
|
241 | $ cd .. | |
240 |
|
242 | |||
241 | convert author committer |
|
243 | convert author committer | |
242 |
|
244 | |||
243 | $ hg convert git-repo4 git-repo4-hg |
|
245 | $ hg convert git-repo4 git-repo4-hg | |
244 | initializing destination git-repo4-hg repository |
|
246 | initializing destination git-repo4-hg repository | |
245 | scanning source... |
|
247 | scanning source... | |
246 | sorting... |
|
248 | sorting... | |
247 | converting... |
|
249 | converting... | |
248 | 1 addfoo |
|
250 | 1 addfoo | |
249 | 0 addfoo2 |
|
251 | 0 addfoo2 | |
250 | updating bookmarks |
|
252 | updating bookmarks | |
251 | $ hg -R git-repo4-hg log -v |
|
253 | $ hg -R git-repo4-hg log -v | |
252 | changeset: 1:d63e967f93da |
|
254 | changeset: 1:d63e967f93da | |
253 | bookmark: master |
|
255 | bookmark: master | |
254 | tag: tip |
|
256 | tag: tip | |
255 | user: nottest <test@example.org> |
|
257 | user: nottest <test@example.org> | |
256 | date: Mon Jan 01 00:00:21 2007 +0000 |
|
258 | date: Mon Jan 01 00:00:21 2007 +0000 | |
257 | files: foo |
|
259 | files: foo | |
258 | description: |
|
260 | description: | |
259 | addfoo2 |
|
261 | addfoo2 | |
260 |
|
262 | |||
261 | committer: test <test@example.org> |
|
263 | committer: test <test@example.org> | |
262 |
|
264 | |||
263 |
|
265 | |||
264 | changeset: 0:0735477b0224 |
|
266 | changeset: 0:0735477b0224 | |
265 | user: test <test@example.org> |
|
267 | user: test <test@example.org> | |
266 | date: Mon Jan 01 00:00:20 2007 +0000 |
|
268 | date: Mon Jan 01 00:00:20 2007 +0000 | |
267 | files: foo |
|
269 | files: foo | |
268 | description: |
|
270 | description: | |
269 | addfoo |
|
271 | addfoo | |
270 |
|
272 | |||
271 |
|
273 | |||
272 |
|
274 | |||
273 | --sourceorder should fail |
|
275 | --sourceorder should fail | |
274 |
|
276 | |||
275 | $ hg convert --sourcesort git-repo4 git-repo4-sourcesort-hg |
|
277 | $ hg convert --sourcesort git-repo4 git-repo4-sourcesort-hg | |
276 | initializing destination git-repo4-sourcesort-hg repository |
|
278 | initializing destination git-repo4-sourcesort-hg repository | |
277 | abort: --sourcesort is not supported by this data source |
|
279 | abort: --sourcesort is not supported by this data source | |
278 | [255] |
|
280 | [255] | |
279 |
|
281 | |||
280 | damage git repository and convert again |
|
282 | damage git repository and convert again | |
281 |
|
283 | |||
282 | $ cat > damage.py <<EOF |
|
284 | $ cat > damage.py <<EOF | |
283 | > import os |
|
285 | > import os | |
284 | > for root, dirs, files in os.walk('git-repo4/.git/objects'): |
|
286 | > for root, dirs, files in os.walk('git-repo4/.git/objects'): | |
285 | > if files: |
|
287 | > if files: | |
286 | > path = os.path.join(root, files[0]) |
|
288 | > path = os.path.join(root, files[0]) | |
287 | > os.remove(path) |
|
289 | > os.remove(path) | |
288 | > break |
|
290 | > break | |
289 | > EOF |
|
291 | > EOF | |
290 | $ python damage.py |
|
292 | $ python damage.py | |
291 | $ hg convert git-repo4 git-repo4-broken-hg 2>&1 | \ |
|
293 | $ hg convert git-repo4 git-repo4-broken-hg 2>&1 | \ | |
292 | > grep 'abort:' | sed 's/abort:.*/abort:/g' |
|
294 | > grep 'abort:' | sed 's/abort:.*/abort:/g' | |
293 | abort: |
|
295 | abort: |
@@ -1,84 +1,86 b'' | |||||
1 |
|
1 | |||
2 | $ "$TESTDIR/hghave" git || exit 80 |
|
2 | $ "$TESTDIR/hghave" git || exit 80 | |
|
3 | $ echo "[core]" >> $HOME/.gitconfig | |||
|
4 | $ echo "autocrlf = false" >> $HOME/.gitconfig | |||
3 | $ echo "[extensions]" >> $HGRCPATH |
|
5 | $ echo "[extensions]" >> $HGRCPATH | |
4 | $ echo "convert=" >> $HGRCPATH |
|
6 | $ echo "convert=" >> $HGRCPATH | |
5 | $ echo 'hgext.graphlog =' >> $HGRCPATH |
|
7 | $ echo 'hgext.graphlog =' >> $HGRCPATH | |
6 | $ echo '[convert]' >> $HGRCPATH |
|
8 | $ echo '[convert]' >> $HGRCPATH | |
7 | $ echo 'hg.usebranchnames = True' >> $HGRCPATH |
|
9 | $ echo 'hg.usebranchnames = True' >> $HGRCPATH | |
8 | $ echo 'hg.tagsbranch = tags-update' >> $HGRCPATH |
|
10 | $ echo 'hg.tagsbranch = tags-update' >> $HGRCPATH | |
9 | $ GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME |
|
11 | $ GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME | |
10 | $ GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL |
|
12 | $ GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL | |
11 | $ 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 | |
12 | $ GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME |
|
14 | $ GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME | |
13 | $ GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL |
|
15 | $ GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL | |
14 | $ GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE |
|
16 | $ GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE | |
15 | $ count=10 |
|
17 | $ count=10 | |
16 | $ action() |
|
18 | $ action() | |
17 | > { |
|
19 | > { | |
18 | > GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000" |
|
20 | > GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000" | |
19 | > GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE" |
|
21 | > GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE" | |
20 | > git "$@" >/dev/null 2>/dev/null || echo "git command error" |
|
22 | > git "$@" >/dev/null 2>/dev/null || echo "git command error" | |
21 | > count=`expr $count + 1` |
|
23 | > count=`expr $count + 1` | |
22 | > } |
|
24 | > } | |
23 | $ glog() |
|
25 | $ glog() | |
24 | > { |
|
26 | > { | |
25 | > hg glog --template '{rev} "{desc|firstline}" files: {files}\n' "$@" |
|
27 | > hg glog --template '{rev} "{desc|firstline}" files: {files}\n' "$@" | |
26 | > } |
|
28 | > } | |
27 | $ convertrepo() |
|
29 | $ convertrepo() | |
28 | > { |
|
30 | > { | |
29 | > hg convert --datesort git-repo hg-repo |
|
31 | > hg convert --datesort git-repo hg-repo | |
30 | > } |
|
32 | > } | |
31 |
|
33 | |||
32 | Build a GIT repo with at least 1 tag |
|
34 | Build a GIT repo with at least 1 tag | |
33 |
|
35 | |||
34 | $ mkdir git-repo |
|
36 | $ mkdir git-repo | |
35 | $ cd git-repo |
|
37 | $ cd git-repo | |
36 | $ git init >/dev/null 2>&1 |
|
38 | $ git init >/dev/null 2>&1 | |
37 | $ echo a > a |
|
39 | $ echo a > a | |
38 | $ git add a |
|
40 | $ git add a | |
39 | $ action commit -m "rev1" |
|
41 | $ action commit -m "rev1" | |
40 | $ action tag -m "tag1" tag1 |
|
42 | $ action tag -m "tag1" tag1 | |
41 | $ cd .. |
|
43 | $ cd .. | |
42 |
|
44 | |||
43 | Do a first conversion |
|
45 | Do a first conversion | |
44 |
|
46 | |||
45 | $ convertrepo |
|
47 | $ convertrepo | |
46 | initializing destination hg-repo repository |
|
48 | initializing destination hg-repo repository | |
47 | scanning source... |
|
49 | scanning source... | |
48 | sorting... |
|
50 | sorting... | |
49 | converting... |
|
51 | converting... | |
50 | 0 rev1 |
|
52 | 0 rev1 | |
51 | updating tags |
|
53 | updating tags | |
52 | updating bookmarks |
|
54 | updating bookmarks | |
53 |
|
55 | |||
54 | Simulate upstream updates after first conversion |
|
56 | Simulate upstream updates after first conversion | |
55 |
|
57 | |||
56 | $ cd git-repo |
|
58 | $ cd git-repo | |
57 | $ echo b > a |
|
59 | $ echo b > a | |
58 | $ git add a |
|
60 | $ git add a | |
59 | $ action commit -m "rev2" |
|
61 | $ action commit -m "rev2" | |
60 | $ action tag -m "tag2" tag2 |
|
62 | $ action tag -m "tag2" tag2 | |
61 | $ cd .. |
|
63 | $ cd .. | |
62 |
|
64 | |||
63 | Perform an incremental conversion |
|
65 | Perform an incremental conversion | |
64 |
|
66 | |||
65 | $ convertrepo |
|
67 | $ convertrepo | |
66 | scanning source... |
|
68 | scanning source... | |
67 | sorting... |
|
69 | sorting... | |
68 | converting... |
|
70 | converting... | |
69 | 0 rev2 |
|
71 | 0 rev2 | |
70 | updating tags |
|
72 | updating tags | |
71 | updating bookmarks |
|
73 | updating bookmarks | |
72 |
|
74 | |||
73 | Print the log |
|
75 | Print the log | |
74 |
|
76 | |||
75 | $ cd hg-repo |
|
77 | $ cd hg-repo | |
76 | $ glog |
|
78 | $ glog | |
77 | o 3 "update tags" files: .hgtags |
|
79 | o 3 "update tags" files: .hgtags | |
78 | | |
|
80 | | | |
79 | | o 2 "rev2" files: a |
|
81 | | o 2 "rev2" files: a | |
80 | | | |
|
82 | | | | |
81 | o | 1 "update tags" files: .hgtags |
|
83 | o | 1 "update tags" files: .hgtags | |
82 | / |
|
84 | / | |
83 | o 0 "rev1" files: a |
|
85 | o 0 "rev1" files: a | |
84 |
|
86 |
General Comments 0
You need to be logged in to leave comments.
Login now