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