tests/test-convert-git
author Thomas Arendsen Hein <thomas@intevation.de>
Thu, 04 Oct 2007 14:23:28 +0200
changeset 5369 8ab7de07f40e
parent 5345 9f35d0bcf00e
child 5380 a5a7f7fd5554
permissions -rwxr-xr-x
test-convert-git: support older git client (1.4.4.4)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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)
5369
8ab7de07f40e test-convert-git: support older git client (1.4.4.4)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5345
diff changeset
    35
git rm -f d/b
5345
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