##// END OF EJS Templates
convert_git: avoid returning two entries for the same file in getchanges...
Alexis S. L. Carvalho -
r5335:88e931f7 default
parent child Browse files
Show More
@@ -61,9 +61,14 b' class convert_git(converter_source):'
61 self.modecache = {}
61 self.modecache = {}
62 fh = self.gitcmd("git-diff-tree --root -m -r %s" % version)
62 fh = self.gitcmd("git-diff-tree --root -m -r %s" % version)
63 changes = []
63 changes = []
64 seen = {}
64 for l in fh:
65 for l in fh:
65 if "\t" not in l: continue
66 if "\t" not in l:
67 continue
66 m, f = l[:-1].split("\t")
68 m, f = l[:-1].split("\t")
69 if f in seen:
70 continue
71 seen[f] = 1
67 m = m.split()
72 m = m.split()
68 h = m[3]
73 h = m[3]
69 p = (m[1] == "100755")
74 p = (m[1] == "100755")
@@ -5,15 +5,42 b''
5 echo "[extensions]" >> $HGRCPATH
5 echo "[extensions]" >> $HGRCPATH
6 echo "convert=" >> $HGRCPATH
6 echo "convert=" >> $HGRCPATH
7
7
8 GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME
9 GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL
10 GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0000"; export GIT_AUTHOR_DATE
11 GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME
12 GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL
13 GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE
14
15 count=10
16 commit()
17 {
18 GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000"
19 GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
20 git commit "$@" >/dev/null 2>/dev/null || echo "git commit error"
21 count=`expr $count + 1`
22 }
23
8 mkdir git-repo
24 mkdir git-repo
9 cd git-repo
25 cd git-repo
10 git init-db >/dev/null 2>/dev/null
26 git init-db >/dev/null 2>/dev/null
11 echo a > a
27 echo a > a
12 git add a
28 git add a
13 git commit -m t1 >/dev/null 2>/dev/null || echo "git commit error"
29 commit -m t1
30
14 echo b >> a
31 echo b >> a
15 git commit -a -m t2 >/dev/null || echo "git commit error"
32 commit -a -m t2.1
33
34 git checkout -b other HEAD^ >/dev/null 2>/dev/null
35 echo c > a
36 echo a >> a
37 commit -a -m t2.2
38
39 git checkout master >/dev/null 2>/dev/null
40 git pull --no-commit . other > /dev/null 2>/dev/null
41 commit -m 'Merge branch other'
16 cd ..
42 cd ..
17
43
18 hg convert git-repo
44 hg convert --datesort git-repo
19
45
46 hg -R git-repo-hg tip -v
@@ -3,5 +3,20 b' initializing destination git-repo-hg rep'
3 scanning source...
3 scanning source...
4 sorting...
4 sorting...
5 converting...
5 converting...
6 1 t1
6 3 t1
7 0 t2
7 2 t2.1
8 1 t2.2
9 0 Merge branch other
10 changeset: 3:f0873470732d
11 tag: tip
12 parent: 1:cb991dbbb06b
13 parent: 2:600bef931ca4
14 user: test <test@example.org>
15 date: Mon Jan 01 00:00:13 2007 +0000
16 files: a
17 description:
18 Merge branch other
19
20 committer: test <test@example.org>
21
22
General Comments 0
You need to be logged in to leave comments. Login now