tests/test-convert-git
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
Wed, 26 Sep 2007 01:58:45 -0300
changeset 5338 f87685355c9c
parent 5335 88e931f74e8b
child 5346 9f35d0bcf00e
permissions -rwxr-xr-x
revlog: fix revlogio.packentry corner case We want to store version information about the revlog in the first entry of its index. The code in packentry was using some heuristics to detect whether this was the first entry, but these heuristics could fail in some cases (e.g. rev 0 was empty; rev 1 descends directly from the nullid and is stored as a delta). We now give the revision number to packentry to avoid heuristics.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5231
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: 5271
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: 5271
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: 5271
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: 5271
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: 5271
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: 5271
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: 5271
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: 5271
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: 5271
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: 5271
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: 5271
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: 5271
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: 5271
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: 5271
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: 5271
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: 5271
diff changeset
    23
5231
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
5271
5c2ca6d6ab21 Make test-convert-git compatible with other git versions (tested with 1.4.4.3)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5231
diff changeset
    26
git init-db >/dev/null 2>/dev/null
5231
ceb6f242fb81 Test git repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    27
echo a > a
ceb6f242fb81 Test git repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    28
git add a
5335
88e931f74e8b convert_git: avoid returning two entries for the same file in getchanges
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5271
diff changeset
    29
commit -m t1
88e931f74e8b convert_git: avoid returning two entries for the same file in getchanges
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5271
diff changeset
    30
5231
ceb6f242fb81 Test git repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    31
echo b >> a
5335
88e931f74e8b convert_git: avoid returning two entries for the same file in getchanges
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5271
diff changeset
    32
commit -a -m t2.1
88e931f74e8b convert_git: avoid returning two entries for the same file in getchanges
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5271
diff changeset
    33
88e931f74e8b convert_git: avoid returning two entries for the same file in getchanges
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5271
diff changeset
    34
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: 5271
diff changeset
    35
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: 5271
diff changeset
    36
echo a >> a
88e931f74e8b convert_git: avoid returning two entries for the same file in getchanges
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5271
diff changeset
    37
commit -a -m t2.2
88e931f74e8b convert_git: avoid returning two entries for the same file in getchanges
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5271
diff changeset
    38
88e931f74e8b convert_git: avoid returning two entries for the same file in getchanges
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5271
diff changeset
    39
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: 5271
diff changeset
    40
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: 5271
diff changeset
    41
commit -m 'Merge branch other'
5231
ceb6f242fb81 Test git repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    42
cd ..
ceb6f242fb81 Test git repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    43
5335
88e931f74e8b convert_git: avoid returning two entries for the same file in getchanges
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5271
diff changeset
    44
hg convert --datesort git-repo
5231
ceb6f242fb81 Test git repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    45
5335
88e931f74e8b convert_git: avoid returning two entries for the same file in getchanges
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5271
diff changeset
    46
hg -R git-repo-hg tip -v