Show More
@@ -1,150 +1,152 b'' | |||||
1 | # git.py - git support for the convert extension |
|
1 | # git.py - git support for the convert extension | |
2 | # |
|
2 | # | |
3 | # Copyright 2005-2009 Matt Mackall <mpm@selenic.com> and others |
|
3 | # Copyright 2005-2009 Matt Mackall <mpm@selenic.com> and others | |
4 | # |
|
4 | # | |
5 | # This software may be used and distributed according to the terms of the |
|
5 | # This software may be used and distributed according to the terms of the | |
6 | # GNU General Public License version 2, incorporated herein by reference. |
|
6 | # GNU General Public License version 2, incorporated herein by reference. | |
7 |
|
7 | |||
8 | import os |
|
8 | import os | |
9 | from mercurial import util |
|
9 | from mercurial import util | |
10 |
|
10 | |||
11 | from common import NoRepo, commit, converter_source, checktool |
|
11 | from common import NoRepo, commit, converter_source, checktool | |
12 |
|
12 | |||
13 | class convert_git(converter_source): |
|
13 | class convert_git(converter_source): | |
14 | # Windows does not support GIT_DIR= construct while other systems |
|
14 | # Windows does not support GIT_DIR= construct while other systems | |
15 | # cannot remove environment variable. Just assume none have |
|
15 | # cannot remove environment variable. Just assume none have | |
16 | # both issues. |
|
16 | # both issues. | |
17 | if hasattr(os, 'unsetenv'): |
|
17 | if hasattr(os, 'unsetenv'): | |
18 | def gitcmd(self, s): |
|
18 | def gitcmd(self, s): | |
19 | prevgitdir = os.environ.get('GIT_DIR') |
|
19 | prevgitdir = os.environ.get('GIT_DIR') | |
20 | os.environ['GIT_DIR'] = self.path |
|
20 | os.environ['GIT_DIR'] = self.path | |
21 | try: |
|
21 | try: | |
22 | return util.popen(s, 'rb') |
|
22 | return util.popen(s, 'rb') | |
23 | finally: |
|
23 | finally: | |
24 | if prevgitdir is None: |
|
24 | if prevgitdir is None: | |
25 | del os.environ['GIT_DIR'] |
|
25 | del os.environ['GIT_DIR'] | |
26 | else: |
|
26 | else: | |
27 | os.environ['GIT_DIR'] = prevgitdir |
|
27 | os.environ['GIT_DIR'] = prevgitdir | |
28 | else: |
|
28 | else: | |
29 | def gitcmd(self, s): |
|
29 | def gitcmd(self, s): | |
30 | return util.popen('GIT_DIR=%s %s' % (self.path, s), 'rb') |
|
30 | return util.popen('GIT_DIR=%s %s' % (self.path, s), 'rb') | |
31 |
|
31 | |||
32 | def __init__(self, ui, path, rev=None): |
|
32 | def __init__(self, ui, path, rev=None): | |
33 | super(convert_git, self).__init__(ui, path, rev=rev) |
|
33 | super(convert_git, self).__init__(ui, path, rev=rev) | |
34 |
|
34 | |||
35 | if os.path.isdir(path + "/.git"): |
|
35 | if os.path.isdir(path + "/.git"): | |
36 | path += "/.git" |
|
36 | path += "/.git" | |
37 | if not os.path.exists(path + "/objects"): |
|
37 | if not os.path.exists(path + "/objects"): | |
38 | raise NoRepo("%s does not look like a Git repo" % path) |
|
38 | raise NoRepo("%s does not look like a Git repo" % path) | |
39 |
|
39 | |||
40 | checktool('git', 'git') |
|
40 | checktool('git', 'git') | |
41 |
|
41 | |||
42 | self.path = path |
|
42 | self.path = path | |
43 |
|
43 | |||
44 | def getheads(self): |
|
44 | def getheads(self): | |
45 | if not self.rev: |
|
45 | if not self.rev: | |
46 | return self.gitcmd('git rev-parse --branches --remotes').read().splitlines() |
|
46 | return self.gitcmd('git rev-parse --branches --remotes').read().splitlines() | |
47 | else: |
|
47 | else: | |
48 | fh = self.gitcmd("git rev-parse --verify %s" % self.rev) |
|
48 | fh = self.gitcmd("git rev-parse --verify %s" % self.rev) | |
49 | return [fh.read()[:-1]] |
|
49 | return [fh.read()[:-1]] | |
50 |
|
50 | |||
51 | def catfile(self, rev, type): |
|
51 | def catfile(self, rev, type): | |
52 | if rev == "0" * 40: raise IOError() |
|
52 | if rev == "0" * 40: raise IOError() | |
53 | fh = self.gitcmd("git cat-file %s %s" % (type, rev)) |
|
53 | fh = self.gitcmd("git cat-file %s %s" % (type, rev)) | |
54 | return fh.read() |
|
54 | return fh.read() | |
55 |
|
55 | |||
56 | def getfile(self, name, rev): |
|
56 | def getfile(self, name, rev): | |
57 | return self.catfile(rev, "blob") |
|
57 | return self.catfile(rev, "blob") | |
58 |
|
58 | |||
59 | def getmode(self, name, rev): |
|
59 | def getmode(self, name, rev): | |
60 | return self.modecache[(name, rev)] |
|
60 | return self.modecache[(name, rev)] | |
61 |
|
61 | |||
62 | def getchanges(self, version): |
|
62 | def getchanges(self, version): | |
63 | self.modecache = {} |
|
63 | self.modecache = {} | |
64 | fh = self.gitcmd("git diff-tree -z --root -m -r %s" % version) |
|
64 | fh = self.gitcmd("git diff-tree -z --root -m -r %s" % version) | |
65 | changes = [] |
|
65 | changes = [] | |
66 | seen = {} |
|
66 | seen = {} | |
67 | entry = None |
|
67 | entry = None | |
68 | for l in fh.read().split('\x00'): |
|
68 | for l in fh.read().split('\x00'): | |
69 | if not entry: |
|
69 | if not entry: | |
70 | if not l.startswith(':'): |
|
70 | if not l.startswith(':'): | |
71 | continue |
|
71 | continue | |
72 | entry = l |
|
72 | entry = l | |
73 | continue |
|
73 | continue | |
74 | f = l |
|
74 | f = l | |
75 | if f not in seen: |
|
75 | if f not in seen: | |
76 | seen[f] = 1 |
|
76 | seen[f] = 1 | |
77 | entry = entry.split() |
|
77 | entry = entry.split() | |
78 | h = entry[3] |
|
78 | h = entry[3] | |
79 | p = (entry[1] == "100755") |
|
79 | p = (entry[1] == "100755") | |
80 | s = (entry[1] == "120000") |
|
80 | s = (entry[1] == "120000") | |
81 | self.modecache[(f, h)] = (p and "x") or (s and "l") or "" |
|
81 | self.modecache[(f, h)] = (p and "x") or (s and "l") or "" | |
82 | changes.append((f, h)) |
|
82 | changes.append((f, h)) | |
83 | entry = None |
|
83 | entry = None | |
84 | return (changes, {}) |
|
84 | return (changes, {}) | |
85 |
|
85 | |||
86 | def getcommit(self, version): |
|
86 | def getcommit(self, version): | |
87 | c = self.catfile(version, "commit") # read the commit hash |
|
87 | c = self.catfile(version, "commit") # read the commit hash | |
88 | end = c.find("\n\n") |
|
88 | end = c.find("\n\n") | |
89 | message = c[end+2:] |
|
89 | message = c[end+2:] | |
90 | message = self.recode(message) |
|
90 | message = self.recode(message) | |
91 | l = c[:end].splitlines() |
|
91 | l = c[:end].splitlines() | |
92 | parents = [] |
|
92 | parents = [] | |
|
93 | author = committer = None | |||
93 | for e in l[1:]: |
|
94 | for e in l[1:]: | |
94 | n, v = e.split(" ", 1) |
|
95 | n, v = e.split(" ", 1) | |
95 | if n == "author": |
|
96 | if n == "author": | |
96 | p = v.split() |
|
97 | p = v.split() | |
97 | tm, tz = p[-2:] |
|
98 | tm, tz = p[-2:] | |
98 | author = " ".join(p[:-2]) |
|
99 | author = " ".join(p[:-2]) | |
99 | if author[0] == "<": author = author[1:-1] |
|
100 | if author[0] == "<": author = author[1:-1] | |
100 | author = self.recode(author) |
|
101 | author = self.recode(author) | |
101 | if n == "committer": |
|
102 | if n == "committer": | |
102 | p = v.split() |
|
103 | p = v.split() | |
103 | tm, tz = p[-2:] |
|
104 | tm, tz = p[-2:] | |
104 | committer = " ".join(p[:-2]) |
|
105 | committer = " ".join(p[:-2]) | |
105 | if committer[0] == "<": committer = committer[1:-1] |
|
106 | if committer[0] == "<": committer = committer[1:-1] | |
106 | committer = self.recode(committer) |
|
107 | committer = self.recode(committer) | |
107 | message += "\ncommitter: %s\n" % committer |
|
|||
108 | if n == "parent": parents.append(v) |
|
108 | if n == "parent": parents.append(v) | |
109 |
|
109 | |||
|
110 | if committer and committer != author: | |||
|
111 | message += "\ncommitter: %s\n" % committer | |||
110 | tzs, tzh, tzm = tz[-5:-4] + "1", tz[-4:-2], tz[-2:] |
|
112 | tzs, tzh, tzm = tz[-5:-4] + "1", tz[-4:-2], tz[-2:] | |
111 | tz = -int(tzs) * (int(tzh) * 3600 + int(tzm)) |
|
113 | tz = -int(tzs) * (int(tzh) * 3600 + int(tzm)) | |
112 | date = tm + " " + str(tz) |
|
114 | date = tm + " " + str(tz) | |
113 |
|
115 | |||
114 | c = commit(parents=parents, date=date, author=author, desc=message, |
|
116 | c = commit(parents=parents, date=date, author=author, desc=message, | |
115 | rev=version) |
|
117 | rev=version) | |
116 | return c |
|
118 | return c | |
117 |
|
119 | |||
118 | def gettags(self): |
|
120 | def gettags(self): | |
119 | tags = {} |
|
121 | tags = {} | |
120 | fh = self.gitcmd('git ls-remote --tags "%s"' % self.path) |
|
122 | fh = self.gitcmd('git ls-remote --tags "%s"' % self.path) | |
121 | prefix = 'refs/tags/' |
|
123 | prefix = 'refs/tags/' | |
122 | for line in fh: |
|
124 | for line in fh: | |
123 | line = line.strip() |
|
125 | line = line.strip() | |
124 | if not line.endswith("^{}"): |
|
126 | if not line.endswith("^{}"): | |
125 | continue |
|
127 | continue | |
126 | node, tag = line.split(None, 1) |
|
128 | node, tag = line.split(None, 1) | |
127 | if not tag.startswith(prefix): |
|
129 | if not tag.startswith(prefix): | |
128 | continue |
|
130 | continue | |
129 | tag = tag[len(prefix):-3] |
|
131 | tag = tag[len(prefix):-3] | |
130 | tags[tag] = node |
|
132 | tags[tag] = node | |
131 |
|
133 | |||
132 | return tags |
|
134 | return tags | |
133 |
|
135 | |||
134 | def getchangedfiles(self, version, i): |
|
136 | def getchangedfiles(self, version, i): | |
135 | changes = [] |
|
137 | changes = [] | |
136 | if i is None: |
|
138 | if i is None: | |
137 | fh = self.gitcmd("git diff-tree --root -m -r %s" % version) |
|
139 | fh = self.gitcmd("git diff-tree --root -m -r %s" % version) | |
138 | for l in fh: |
|
140 | for l in fh: | |
139 | if "\t" not in l: |
|
141 | if "\t" not in l: | |
140 | continue |
|
142 | continue | |
141 | m, f = l[:-1].split("\t") |
|
143 | m, f = l[:-1].split("\t") | |
142 | changes.append(f) |
|
144 | changes.append(f) | |
143 | fh.close() |
|
145 | fh.close() | |
144 | else: |
|
146 | else: | |
145 | fh = self.gitcmd('git diff-tree --name-only --root -r %s "%s^%s" --' |
|
147 | fh = self.gitcmd('git diff-tree --name-only --root -r %s "%s^%s" --' | |
146 | % (version, version, i+1)) |
|
148 | % (version, version, i+1)) | |
147 | changes = [f.rstrip('\n') for f in fh] |
|
149 | changes = [f.rstrip('\n') for f in fh] | |
148 | fh.close() |
|
150 | fh.close() | |
149 |
|
151 | |||
150 | return changes |
|
152 | return changes |
@@ -1,151 +1,169 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^ >/dev/null 2>/dev/null |
|
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^ >/dev/null 2>/dev/null |
|
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^ >/dev/null 2>/dev/null |
|
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^ >/dev/null 2>/dev/null |
|
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 |
|
152 | |||
|
153 | echo | |||
|
154 | echo '% test author vs committer' | |||
|
155 | mkdir git-repo4 | |||
|
156 | cd git-repo4 | |||
|
157 | git init-db >/dev/null 2>/dev/null | |||
|
158 | echo >> foo | |||
|
159 | git add foo | |||
|
160 | commit -a -m addfoo | |||
|
161 | echo >> foo | |||
|
162 | GIT_AUTHOR_NAME="nottest" | |||
|
163 | commit -a -m addfoo2 | |||
|
164 | cd .. | |||
|
165 | ||||
|
166 | echo '% convert author committer' | |||
|
167 | hg convert git-repo4 git-repo4-hg | |||
|
168 | cd git-repo4-hg | |||
|
169 | hg log -v |
@@ -1,100 +1,126 b'' | |||||
1 | rm 'd/b' |
|
1 | rm 'd/b' | |
2 | assuming destination git-repo-hg |
|
2 | assuming destination git-repo-hg | |
3 | initializing destination git-repo-hg repository |
|
3 | initializing destination git-repo-hg repository | |
4 | scanning source... |
|
4 | scanning source... | |
5 | sorting... |
|
5 | sorting... | |
6 | converting... |
|
6 | converting... | |
7 | 5 t1 |
|
7 | 5 t1 | |
8 | 4 t2 |
|
8 | 4 t2 | |
9 | 3 t3 |
|
9 | 3 t3 | |
10 | 2 t4.1 |
|
10 | 2 t4.1 | |
11 | 1 t4.2 |
|
11 | 1 t4.2 | |
12 | 0 Merge branch other |
|
12 | 0 Merge branch other | |
13 |
changeset: 5: |
|
13 | changeset: 5:c78094926be2 | |
14 | tag: tip |
|
14 | tag: tip | |
15 |
parent: 3: |
|
15 | parent: 3:f5f5cb45432b | |
16 |
parent: 4: |
|
16 | parent: 4:4e174f80c67c | |
17 | user: test <test@example.org> |
|
17 | user: test <test@example.org> | |
18 | date: Mon Jan 01 00:00:15 2007 +0000 |
|
18 | date: Mon Jan 01 00:00:15 2007 +0000 | |
19 | files: a |
|
19 | files: a | |
20 | description: |
|
20 | description: | |
21 | Merge branch other |
|
21 | Merge branch other | |
22 |
|
22 | |||
23 | committer: test <test@example.org> |
|
|||
24 |
|
||||
25 |
|
23 | |||
26 | % full conversion |
|
24 | % full conversion | |
27 | @ 9 "Discard change to foo" files: foo |
|
25 | @ 9 "Discard change to foo" files: foo | |
28 | |\ |
|
26 | |\ | |
29 | | o 8 "change foo" files: foo |
|
27 | | o 8 "change foo" files: foo | |
30 | | | |
|
28 | | | | |
31 | o | 7 "change bar" files: bar |
|
29 | o | 7 "change bar" files: bar | |
32 | |/ |
|
30 | |/ | |
33 | o 6 "(octopus merge fixup)" files: |
|
31 | o 6 "(octopus merge fixup)" files: | |
34 | |\ |
|
32 | |\ | |
35 | | o 5 "Octopus merge" files: baz |
|
33 | | o 5 "Octopus merge" files: baz | |
36 | | |\ |
|
34 | | |\ | |
37 | o | | 4 "add baz" files: baz |
|
35 | o | | 4 "add baz" files: baz | |
38 | | | | |
|
36 | | | | | |
39 | +---o 3 "add bar" files: bar |
|
37 | +---o 3 "add bar" files: bar | |
40 | | | |
|
38 | | | | |
41 | o | 2 "add quux" files: quux |
|
39 | o | 2 "add quux" files: quux | |
42 | | | |
|
40 | | | | |
43 | | o 1 "change foo" files: foo |
|
41 | | o 1 "change foo" files: foo | |
44 | |/ |
|
42 | |/ | |
45 | o 0 "add foo" files: foo |
|
43 | o 0 "add foo" files: foo | |
46 |
|
44 | |||
47 | 245a3b8bc653999c2b22cdabd517ccb47aecafdf 644 bar |
|
45 | 245a3b8bc653999c2b22cdabd517ccb47aecafdf 644 bar | |
48 | 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz |
|
46 | 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz | |
49 | 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo |
|
47 | 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo | |
50 | 88dfeab657e8cf2cef3dec67b914f49791ae76b1 644 quux |
|
48 | 88dfeab657e8cf2cef3dec67b914f49791ae76b1 644 quux | |
51 | % foo bar baz: octopus merge |
|
49 | % foo bar baz: octopus merge | |
52 | @ 8 "Discard change to foo" files: foo |
|
50 | @ 8 "Discard change to foo" files: foo | |
53 | |\ |
|
51 | |\ | |
54 | | o 7 "change foo" files: foo |
|
52 | | o 7 "change foo" files: foo | |
55 | | | |
|
53 | | | | |
56 | o | 6 "change bar" files: bar |
|
54 | o | 6 "change bar" files: bar | |
57 | |/ |
|
55 | |/ | |
58 | o 5 "(octopus merge fixup)" files: |
|
56 | o 5 "(octopus merge fixup)" files: | |
59 | |\ |
|
57 | |\ | |
60 | | o 4 "Octopus merge" files: baz |
|
58 | | o 4 "Octopus merge" files: baz | |
61 | | |\ |
|
59 | | |\ | |
62 | o | | 3 "add baz" files: baz |
|
60 | o | | 3 "add baz" files: baz | |
63 | | | | |
|
61 | | | | | |
64 | +---o 2 "add bar" files: bar |
|
62 | +---o 2 "add bar" files: bar | |
65 | | | |
|
63 | | | | |
66 | | o 1 "change foo" files: foo |
|
64 | | o 1 "change foo" files: foo | |
67 | |/ |
|
65 | |/ | |
68 | o 0 "add foo" files: foo |
|
66 | o 0 "add foo" files: foo | |
69 |
|
67 | |||
70 | 245a3b8bc653999c2b22cdabd517ccb47aecafdf 644 bar |
|
68 | 245a3b8bc653999c2b22cdabd517ccb47aecafdf 644 bar | |
71 | 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz |
|
69 | 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz | |
72 | 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo |
|
70 | 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo | |
73 | % foo baz quux: only some parents of an octopus merge; "discard" a head |
|
71 | % foo baz quux: only some parents of an octopus merge; "discard" a head | |
74 | @ 6 "Discard change to foo" files: foo |
|
72 | @ 6 "Discard change to foo" files: foo | |
75 | | |
|
73 | | | |
76 | o 5 "change foo" files: foo |
|
74 | o 5 "change foo" files: foo | |
77 | | |
|
75 | | | |
78 | o 4 "Octopus merge" files: |
|
76 | o 4 "Octopus merge" files: | |
79 | |\ |
|
77 | |\ | |
80 | | o 3 "add baz" files: baz |
|
78 | | o 3 "add baz" files: baz | |
81 | | | |
|
79 | | | | |
82 | | o 2 "add quux" files: quux |
|
80 | | o 2 "add quux" files: quux | |
83 | | | |
|
81 | | | | |
84 | o | 1 "change foo" files: foo |
|
82 | o | 1 "change foo" files: foo | |
85 | |/ |
|
83 | |/ | |
86 | o 0 "add foo" files: foo |
|
84 | o 0 "add foo" files: foo | |
87 |
|
85 | |||
88 | 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz |
|
86 | 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz | |
89 | 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo |
|
87 | 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo | |
90 | 88dfeab657e8cf2cef3dec67b914f49791ae76b1 644 quux |
|
88 | 88dfeab657e8cf2cef3dec67b914f49791ae76b1 644 quux | |
91 |
|
89 | |||
92 | % test binary conversion (issue 1359) |
|
90 | % test binary conversion (issue 1359) | |
93 | % convert binary file |
|
91 | % convert binary file | |
94 | initializing destination git-repo3-hg repository |
|
92 | initializing destination git-repo3-hg repository | |
95 | scanning source... |
|
93 | scanning source... | |
96 | sorting... |
|
94 | sorting... | |
97 | converting... |
|
95 | converting... | |
98 | 0 addbinary |
|
96 | 0 addbinary | |
99 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
97 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
100 | 4096 |
|
98 | 4096 | |
|
99 | ||||
|
100 | % test author vs committer | |||
|
101 | % convert author committer | |||
|
102 | initializing destination git-repo4-hg repository | |||
|
103 | scanning source... | |||
|
104 | sorting... | |||
|
105 | converting... | |||
|
106 | 1 addfoo | |||
|
107 | 0 addfoo2 | |||
|
108 | changeset: 1:d63e967f93da | |||
|
109 | tag: tip | |||
|
110 | user: nottest <test@example.org> | |||
|
111 | date: Mon Jan 01 00:00:21 2007 +0000 | |||
|
112 | files: foo | |||
|
113 | description: | |||
|
114 | addfoo2 | |||
|
115 | ||||
|
116 | committer: test <test@example.org> | |||
|
117 | ||||
|
118 | ||||
|
119 | changeset: 0:0735477b0224 | |||
|
120 | user: test <test@example.org> | |||
|
121 | date: Mon Jan 01 00:00:20 2007 +0000 | |||
|
122 | files: foo | |||
|
123 | description: | |||
|
124 | addfoo | |||
|
125 | ||||
|
126 |
General Comments 0
You need to be logged in to leave comments.
Login now