Show More
@@ -1,173 +1,173 b'' | |||||
1 | #!/bin/sh |
|
1 | #!/bin/sh | |
2 |
|
2 | |||
3 | "$TESTDIR/hghave" git || exit 80 |
|
3 | "$TESTDIR/hghave" git || exit 80 | |
4 |
|
4 | |||
5 | echo "[extensions]" >> $HGRCPATH |
|
5 | echo "[extensions]" >> $HGRCPATH | |
6 | echo "convert=" >> $HGRCPATH |
|
6 | echo "convert=" >> $HGRCPATH | |
7 | echo 'hgext.graphlog =' >> $HGRCPATH |
|
7 | echo 'hgext.graphlog =' >> $HGRCPATH | |
8 |
|
8 | |||
9 | GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME |
|
9 | GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME | |
10 | GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL |
|
10 | 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 |
|
11 | 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 |
|
12 | GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME | |
13 | GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL |
|
13 | GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL | |
14 | GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE |
|
14 | GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE | |
15 |
|
15 | |||
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 |
|
24 | |||
25 | mkdir git-repo |
|
25 | mkdir git-repo | |
26 | cd git-repo |
|
26 | cd git-repo | |
27 | git init-db >/dev/null 2>/dev/null |
|
27 | git init-db >/dev/null 2>/dev/null | |
28 | echo a > a |
|
28 | echo a > a | |
29 | mkdir d |
|
29 | mkdir d | |
30 | echo b > d/b |
|
30 | echo b > d/b | |
31 | git add a d |
|
31 | git add a d | |
32 | commit -a -m t1 |
|
32 | commit -a -m t1 | |
33 |
|
33 | |||
34 | # Remove the directory, then try to replace it with a file |
|
34 | # Remove the directory, then try to replace it with a file | |
35 | # (issue 754) |
|
35 | # (issue 754) | |
36 | git rm -f d/b |
|
36 | git rm -f d/b | |
37 | commit -m t2 |
|
37 | commit -m t2 | |
38 | echo d > d |
|
38 | echo d > d | |
39 | git add d |
|
39 | git add d | |
40 | commit -m t3 |
|
40 | commit -m t3 | |
41 |
|
41 | |||
42 | echo b >> a |
|
42 | echo b >> a | |
43 | commit -a -m t4.1 |
|
43 | commit -a -m t4.1 | |
44 |
|
44 | |||
45 |
git checkout -b other HEAD |
|
45 | git checkout -b other HEAD~ >/dev/null 2>/dev/null | |
46 | echo c > a |
|
46 | echo c > a | |
47 | echo a >> a |
|
47 | echo a >> a | |
48 | commit -a -m t4.2 |
|
48 | commit -a -m t4.2 | |
49 |
|
49 | |||
50 | git checkout master >/dev/null 2>/dev/null |
|
50 | git checkout master >/dev/null 2>/dev/null | |
51 | git pull --no-commit . other > /dev/null 2>/dev/null |
|
51 | git pull --no-commit . other > /dev/null 2>/dev/null | |
52 | commit -m 'Merge branch other' |
|
52 | commit -m 'Merge branch other' | |
53 | cd .. |
|
53 | cd .. | |
54 |
|
54 | |||
55 | hg convert --datesort git-repo |
|
55 | hg convert --datesort git-repo | |
56 | hg up -q -R git-repo-hg |
|
56 | hg up -q -R git-repo-hg | |
57 | hg -R git-repo-hg tip -v |
|
57 | hg -R git-repo-hg tip -v | |
58 |
|
58 | |||
59 | count=10 |
|
59 | count=10 | |
60 | mkdir git-repo2 |
|
60 | mkdir git-repo2 | |
61 | cd git-repo2 |
|
61 | cd git-repo2 | |
62 | git init-db >/dev/null 2>/dev/null |
|
62 | git init-db >/dev/null 2>/dev/null | |
63 |
|
63 | |||
64 | echo foo > foo |
|
64 | echo foo > foo | |
65 | git add foo |
|
65 | git add foo | |
66 | commit -a -m 'add foo' |
|
66 | commit -a -m 'add foo' | |
67 |
|
67 | |||
68 | echo >> foo |
|
68 | echo >> foo | |
69 | commit -a -m 'change foo' |
|
69 | commit -a -m 'change foo' | |
70 |
|
70 | |||
71 |
git checkout -b Bar HEAD |
|
71 | git checkout -b Bar HEAD~ >/dev/null 2>/dev/null | |
72 | echo quux >> quux |
|
72 | echo quux >> quux | |
73 | git add quux |
|
73 | git add quux | |
74 | commit -a -m 'add quux' |
|
74 | commit -a -m 'add quux' | |
75 |
|
75 | |||
76 | echo bar > bar |
|
76 | echo bar > bar | |
77 | git add bar |
|
77 | git add bar | |
78 | commit -a -m 'add bar' |
|
78 | commit -a -m 'add bar' | |
79 |
|
79 | |||
80 |
git checkout -b Baz HEAD |
|
80 | git checkout -b Baz HEAD~ >/dev/null 2>/dev/null | |
81 | echo baz > baz |
|
81 | echo baz > baz | |
82 | git add baz |
|
82 | git add baz | |
83 | commit -a -m 'add baz' |
|
83 | commit -a -m 'add baz' | |
84 |
|
84 | |||
85 | git checkout master >/dev/null 2>/dev/null |
|
85 | git checkout master >/dev/null 2>/dev/null | |
86 | git pull --no-commit . Bar Baz > /dev/null 2>/dev/null |
|
86 | git pull --no-commit . Bar Baz > /dev/null 2>/dev/null | |
87 | commit -m 'Octopus merge' |
|
87 | commit -m 'Octopus merge' | |
88 |
|
88 | |||
89 | echo bar >> bar |
|
89 | echo bar >> bar | |
90 | commit -a -m 'change bar' |
|
90 | commit -a -m 'change bar' | |
91 |
|
91 | |||
92 |
git checkout -b Foo HEAD |
|
92 | git checkout -b Foo HEAD~ >/dev/null 2>/dev/null | |
93 | echo >> foo |
|
93 | echo >> foo | |
94 | commit -a -m 'change foo' |
|
94 | commit -a -m 'change foo' | |
95 |
|
95 | |||
96 | git checkout master >/dev/null 2>/dev/null |
|
96 | git checkout master >/dev/null 2>/dev/null | |
97 | git pull --no-commit -s ours . Foo > /dev/null 2>/dev/null |
|
97 | git pull --no-commit -s ours . Foo > /dev/null 2>/dev/null | |
98 | commit -m 'Discard change to foo' |
|
98 | commit -m 'Discard change to foo' | |
99 |
|
99 | |||
100 | cd .. |
|
100 | cd .. | |
101 |
|
101 | |||
102 | glog() |
|
102 | glog() | |
103 | { |
|
103 | { | |
104 | hg glog --template '{rev} "{desc|firstline}" files: {files}\n' "$@" |
|
104 | hg glog --template '{rev} "{desc|firstline}" files: {files}\n' "$@" | |
105 | } |
|
105 | } | |
106 |
|
106 | |||
107 | splitrepo() |
|
107 | splitrepo() | |
108 | { |
|
108 | { | |
109 | msg="$1" |
|
109 | msg="$1" | |
110 | files="$2" |
|
110 | files="$2" | |
111 | opts=$3 |
|
111 | opts=$3 | |
112 | echo "% $files: $msg" |
|
112 | echo "% $files: $msg" | |
113 | prefix=`echo "$files" | sed -e 's/ /-/g'` |
|
113 | prefix=`echo "$files" | sed -e 's/ /-/g'` | |
114 | fmap="$prefix.fmap" |
|
114 | fmap="$prefix.fmap" | |
115 | repo="$prefix.repo" |
|
115 | repo="$prefix.repo" | |
116 | for i in $files; do |
|
116 | for i in $files; do | |
117 | echo "include $i" >> "$fmap" |
|
117 | echo "include $i" >> "$fmap" | |
118 | done |
|
118 | done | |
119 | hg -q convert $opts --filemap "$fmap" --datesort git-repo2 "$repo" |
|
119 | hg -q convert $opts --filemap "$fmap" --datesort git-repo2 "$repo" | |
120 | hg up -q -R "$repo" |
|
120 | hg up -q -R "$repo" | |
121 | glog -R "$repo" |
|
121 | glog -R "$repo" | |
122 | hg -R "$repo" manifest --debug |
|
122 | hg -R "$repo" manifest --debug | |
123 | } |
|
123 | } | |
124 |
|
124 | |||
125 | echo '% full conversion' |
|
125 | echo '% full conversion' | |
126 | hg -q convert --datesort git-repo2 fullrepo |
|
126 | hg -q convert --datesort git-repo2 fullrepo | |
127 | hg up -q -R fullrepo |
|
127 | hg up -q -R fullrepo | |
128 | glog -R fullrepo |
|
128 | glog -R fullrepo | |
129 | hg -R fullrepo manifest --debug |
|
129 | hg -R fullrepo manifest --debug | |
130 |
|
130 | |||
131 | splitrepo 'octopus merge' 'foo bar baz' |
|
131 | splitrepo 'octopus merge' 'foo bar baz' | |
132 |
|
132 | |||
133 | splitrepo 'only some parents of an octopus merge; "discard" a head' 'foo baz quux' |
|
133 | splitrepo 'only some parents of an octopus merge; "discard" a head' 'foo baz quux' | |
134 |
|
134 | |||
135 | echo |
|
135 | echo | |
136 | echo '% test binary conversion (issue 1359)' |
|
136 | echo '% test binary conversion (issue 1359)' | |
137 | mkdir git-repo3 |
|
137 | mkdir git-repo3 | |
138 | cd git-repo3 |
|
138 | cd git-repo3 | |
139 | git init-db >/dev/null 2>/dev/null |
|
139 | git init-db >/dev/null 2>/dev/null | |
140 | python -c 'file("b", "wb").write("".join([chr(i) for i in range(256)])*16)' |
|
140 | python -c 'file("b", "wb").write("".join([chr(i) for i in range(256)])*16)' | |
141 | git add b |
|
141 | git add b | |
142 | commit -a -m addbinary |
|
142 | commit -a -m addbinary | |
143 | cd .. |
|
143 | cd .. | |
144 |
|
144 | |||
145 | echo '% convert binary file' |
|
145 | echo '% convert binary file' | |
146 | hg convert git-repo3 git-repo3-hg |
|
146 | hg convert git-repo3 git-repo3-hg | |
147 |
|
147 | |||
148 | cd git-repo3-hg |
|
148 | cd git-repo3-hg | |
149 | hg up -C |
|
149 | hg up -C | |
150 | python -c 'print len(file("b", "rb").read())' |
|
150 | python -c 'print len(file("b", "rb").read())' | |
151 | cd .. |
|
151 | cd .. | |
152 |
|
152 | |||
153 | echo |
|
153 | echo | |
154 | echo '% test author vs committer' |
|
154 | echo '% test author vs committer' | |
155 | mkdir git-repo4 |
|
155 | mkdir git-repo4 | |
156 | cd git-repo4 |
|
156 | cd git-repo4 | |
157 | git init-db >/dev/null 2>/dev/null |
|
157 | git init-db >/dev/null 2>/dev/null | |
158 | echo >> foo |
|
158 | echo >> foo | |
159 | git add foo |
|
159 | git add foo | |
160 | commit -a -m addfoo |
|
160 | commit -a -m addfoo | |
161 | echo >> foo |
|
161 | echo >> foo | |
162 | GIT_AUTHOR_NAME="nottest" |
|
162 | GIT_AUTHOR_NAME="nottest" | |
163 | commit -a -m addfoo2 |
|
163 | commit -a -m addfoo2 | |
164 | cd .. |
|
164 | cd .. | |
165 |
|
165 | |||
166 | echo '% convert author committer' |
|
166 | echo '% convert author committer' | |
167 | hg convert git-repo4 git-repo4-hg |
|
167 | hg convert git-repo4 git-repo4-hg | |
168 | hg -R git-repo4-hg log -v |
|
168 | hg -R git-repo4-hg log -v | |
169 |
|
169 | |||
170 | echo '% --sourceorder should fail' |
|
170 | echo '% --sourceorder should fail' | |
171 | hg convert --sourcesort git-repo4 git-repo4-sourcesort-hg |
|
171 | hg convert --sourcesort git-repo4 git-repo4-sourcesort-hg | |
172 |
|
172 | |||
173 | true |
|
173 | true |
General Comments 0
You need to be logged in to leave comments.
Login now