annotate tests/test-convert-git @ 5345:9f35d0bcf00e

Test mercurial convert sink removes empty directories.
author Patrick Mezard <pmezard@gmail.com>
date Sun, 30 Sep 2007 12:08:33 +0200
parents 88e931f74e8b
children 8ab7de07f40e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5219
ceb6f242fb81 Test git repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
1 #!/bin/sh
ceb6f242fb81 Test git repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
2
ceb6f242fb81 Test git repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
3 "$TESTDIR/hghave" git || exit 80
ceb6f242fb81 Test git repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
4
ceb6f242fb81 Test git repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
5 echo "[extensions]" >> $HGRCPATH
ceb6f242fb81 Test git repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
6 echo "convert=" >> $HGRCPATH
ceb6f242fb81 Test git repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
7
5335
88e931f74e8b convert_git: avoid returning two entries for the same file in getchanges
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5231
diff changeset
8 GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME
88e931f74e8b convert_git: avoid returning two entries for the same file in getchanges
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5231
diff changeset
9 GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL
88e931f74e8b convert_git: avoid returning two entries for the same file in getchanges
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5231
diff changeset
10 GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0000"; export GIT_AUTHOR_DATE
88e931f74e8b convert_git: avoid returning two entries for the same file in getchanges
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5231
diff changeset
11 GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME
88e931f74e8b convert_git: avoid returning two entries for the same file in getchanges
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5231
diff changeset
12 GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL
88e931f74e8b convert_git: avoid returning two entries for the same file in getchanges
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5231
diff changeset
13 GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE
88e931f74e8b convert_git: avoid returning two entries for the same file in getchanges
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5231
diff changeset
14
88e931f74e8b convert_git: avoid returning two entries for the same file in getchanges
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5231
diff changeset
15 count=10
88e931f74e8b convert_git: avoid returning two entries for the same file in getchanges
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5231
diff changeset
16 commit()
88e931f74e8b convert_git: avoid returning two entries for the same file in getchanges
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5231
diff changeset
17 {
88e931f74e8b convert_git: avoid returning two entries for the same file in getchanges
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5231
diff changeset
18 GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000"
88e931f74e8b convert_git: avoid returning two entries for the same file in getchanges
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5231
diff changeset
19 GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
88e931f74e8b convert_git: avoid returning two entries for the same file in getchanges
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5231
diff changeset
20 git commit "$@" >/dev/null 2>/dev/null || echo "git commit error"
88e931f74e8b convert_git: avoid returning two entries for the same file in getchanges
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5231
diff changeset
21 count=`expr $count + 1`
88e931f74e8b convert_git: avoid returning two entries for the same file in getchanges
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5231
diff changeset
22 }
88e931f74e8b convert_git: avoid returning two entries for the same file in getchanges
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5231
diff changeset
23
5219
ceb6f242fb81 Test git repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
24 mkdir git-repo
ceb6f242fb81 Test git repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
25 cd git-repo
5231
5c2ca6d6ab21 Make test-convert-git compatible with other git versions (tested with 1.4.4.3)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5219
diff changeset
26 git init-db >/dev/null 2>/dev/null
5219
ceb6f242fb81 Test git repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
27 echo a > a
5345
9f35d0bcf00e Test mercurial convert sink removes empty directories.
Patrick Mezard <pmezard@gmail.com>
parents: 5335
diff changeset
28 mkdir d
9f35d0bcf00e Test mercurial convert sink removes empty directories.
Patrick Mezard <pmezard@gmail.com>
parents: 5335
diff changeset
29 echo b > d/b
9f35d0bcf00e Test mercurial convert sink removes empty directories.
Patrick Mezard <pmezard@gmail.com>
parents: 5335
diff changeset
30 git add a d
9f35d0bcf00e Test mercurial convert sink removes empty directories.
Patrick Mezard <pmezard@gmail.com>
parents: 5335
diff changeset
31 commit -a -m t1
9f35d0bcf00e Test mercurial convert sink removes empty directories.
Patrick Mezard <pmezard@gmail.com>
parents: 5335
diff changeset
32
9f35d0bcf00e Test mercurial convert sink removes empty directories.
Patrick Mezard <pmezard@gmail.com>
parents: 5335
diff changeset
33 # Remove the directory, then try to replace it with a file
9f35d0bcf00e Test mercurial convert sink removes empty directories.
Patrick Mezard <pmezard@gmail.com>
parents: 5335
diff changeset
34 # (issue 754)
9f35d0bcf00e Test mercurial convert sink removes empty directories.
Patrick Mezard <pmezard@gmail.com>
parents: 5335
diff changeset
35 git rm -r d
9f35d0bcf00e Test mercurial convert sink removes empty directories.
Patrick Mezard <pmezard@gmail.com>
parents: 5335
diff changeset
36 commit -m t2
9f35d0bcf00e Test mercurial convert sink removes empty directories.
Patrick Mezard <pmezard@gmail.com>
parents: 5335
diff changeset
37 echo d > d
9f35d0bcf00e Test mercurial convert sink removes empty directories.
Patrick Mezard <pmezard@gmail.com>
parents: 5335
diff changeset
38 git add d
9f35d0bcf00e Test mercurial convert sink removes empty directories.
Patrick Mezard <pmezard@gmail.com>
parents: 5335
diff changeset
39 commit -m t3
5335
88e931f74e8b convert_git: avoid returning two entries for the same file in getchanges
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5231
diff changeset
40
5219
ceb6f242fb81 Test git repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
41 echo b >> a
5345
9f35d0bcf00e Test mercurial convert sink removes empty directories.
Patrick Mezard <pmezard@gmail.com>
parents: 5335
diff changeset
42 commit -a -m t4.1
5335
88e931f74e8b convert_git: avoid returning two entries for the same file in getchanges
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5231
diff changeset
43
88e931f74e8b convert_git: avoid returning two entries for the same file in getchanges
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5231
diff changeset
44 git checkout -b other HEAD^ >/dev/null 2>/dev/null
88e931f74e8b convert_git: avoid returning two entries for the same file in getchanges
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5231
diff changeset
45 echo c > a
88e931f74e8b convert_git: avoid returning two entries for the same file in getchanges
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5231
diff changeset
46 echo a >> a
5345
9f35d0bcf00e Test mercurial convert sink removes empty directories.
Patrick Mezard <pmezard@gmail.com>
parents: 5335
diff changeset
47 commit -a -m t4.2
5335
88e931f74e8b convert_git: avoid returning two entries for the same file in getchanges
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5231
diff changeset
48
88e931f74e8b convert_git: avoid returning two entries for the same file in getchanges
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5231
diff changeset
49 git checkout master >/dev/null 2>/dev/null
88e931f74e8b convert_git: avoid returning two entries for the same file in getchanges
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5231
diff changeset
50 git pull --no-commit . other > /dev/null 2>/dev/null
88e931f74e8b convert_git: avoid returning two entries for the same file in getchanges
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5231
diff changeset
51 commit -m 'Merge branch other'
5219
ceb6f242fb81 Test git repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
52 cd ..
ceb6f242fb81 Test git repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
53
5335
88e931f74e8b convert_git: avoid returning two entries for the same file in getchanges
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5231
diff changeset
54 hg convert --datesort git-repo
5219
ceb6f242fb81 Test git repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
55
5335
88e931f74e8b convert_git: avoid returning two entries for the same file in getchanges
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5231
diff changeset
56 hg -R git-repo-hg tip -v