tests/test-convert-git
author Matt Mackall <mpm@selenic.com>
Fri, 07 May 2010 16:59:00 -0500
changeset 11122 2114e44b08f6
parent 10990 bb377a311109
permissions -rwxr-xr-x
clean up remaining generic exceptions
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
5380
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
     7
echo 'hgext.graphlog =' >> $HGRCPATH
5219
ceb6f242fb81 Test git repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     8
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
     9
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
    10
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
    11
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
    12
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
    13
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
    14
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
    15
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
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
    17
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
    18
{
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_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
    20
    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
    21
    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
    22
    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
    23
}
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
    24
5219
ceb6f242fb81 Test git repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    25
mkdir git-repo
ceb6f242fb81 Test git repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    26
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
    27
git init-db >/dev/null 2>/dev/null
5219
ceb6f242fb81 Test git repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    28
echo a > a
5345
9f35d0bcf00e Test mercurial convert sink removes empty directories.
Patrick Mezard <pmezard@gmail.com>
parents: 5335
diff changeset
    29
mkdir d
9f35d0bcf00e Test mercurial convert sink removes empty directories.
Patrick Mezard <pmezard@gmail.com>
parents: 5335
diff changeset
    30
echo b > d/b
9f35d0bcf00e Test mercurial convert sink removes empty directories.
Patrick Mezard <pmezard@gmail.com>
parents: 5335
diff changeset
    31
git add a d
9f35d0bcf00e Test mercurial convert sink removes empty directories.
Patrick Mezard <pmezard@gmail.com>
parents: 5335
diff changeset
    32
commit -a -m t1
9f35d0bcf00e Test mercurial convert sink removes empty directories.
Patrick Mezard <pmezard@gmail.com>
parents: 5335
diff changeset
    33
9f35d0bcf00e Test mercurial convert sink removes empty directories.
Patrick Mezard <pmezard@gmail.com>
parents: 5335
diff changeset
    34
# 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
    35
# (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
    36
git rm -f d/b
5345
9f35d0bcf00e Test mercurial convert sink removes empty directories.
Patrick Mezard <pmezard@gmail.com>
parents: 5335
diff changeset
    37
commit -m t2
9f35d0bcf00e Test mercurial convert sink removes empty directories.
Patrick Mezard <pmezard@gmail.com>
parents: 5335
diff changeset
    38
echo d > d
9f35d0bcf00e Test mercurial convert sink removes empty directories.
Patrick Mezard <pmezard@gmail.com>
parents: 5335
diff changeset
    39
git add d
9f35d0bcf00e Test mercurial convert sink removes empty directories.
Patrick Mezard <pmezard@gmail.com>
parents: 5335
diff changeset
    40
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
    41
5219
ceb6f242fb81 Test git repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    42
echo b >> a
5345
9f35d0bcf00e Test mercurial convert sink removes empty directories.
Patrick Mezard <pmezard@gmail.com>
parents: 5335
diff changeset
    43
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
    44
9434
f5ce9b052747 test-convert-git: Use ~ instead of ^
Mads Kiilerich <mads@kiilerich.com>
parents: 8691
diff changeset
    45
git checkout -b other HEAD~ >/dev/null 2>/dev/null
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
    46
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
    47
echo a >> a
5345
9f35d0bcf00e Test mercurial convert sink removes empty directories.
Patrick Mezard <pmezard@gmail.com>
parents: 5335
diff changeset
    48
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
    49
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 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
    51
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
    52
commit -m 'Merge branch other'
5219
ceb6f242fb81 Test git repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    53
cd ..
ceb6f242fb81 Test git repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    54
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
    55
hg convert --datesort git-repo
6737
7239e06e58e9 context: consistently return p1 context for None
Matt Mackall <mpm@selenic.com>
parents: 5380
diff changeset
    56
hg up -q -R git-repo-hg
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
    57
hg -R git-repo-hg tip -v
5380
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
    58
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
    59
count=10
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
    60
mkdir git-repo2
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
    61
cd git-repo2
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
    62
git init-db >/dev/null 2>/dev/null
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
    63
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
    64
echo foo > foo
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
    65
git add foo
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
    66
commit -a -m 'add foo'
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
    67
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
    68
echo >> foo
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
    69
commit -a -m 'change foo'
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
    70
9434
f5ce9b052747 test-convert-git: Use ~ instead of ^
Mads Kiilerich <mads@kiilerich.com>
parents: 8691
diff changeset
    71
git checkout -b Bar HEAD~ >/dev/null 2>/dev/null
5380
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
    72
echo quux >> quux
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
    73
git add quux
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
    74
commit -a -m 'add quux'
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
    75
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
    76
echo bar > bar
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
    77
git add bar
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
    78
commit -a -m 'add bar'
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
    79
9434
f5ce9b052747 test-convert-git: Use ~ instead of ^
Mads Kiilerich <mads@kiilerich.com>
parents: 8691
diff changeset
    80
git checkout -b Baz HEAD~ >/dev/null 2>/dev/null
5380
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
    81
echo baz > baz
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
    82
git add baz
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
    83
commit -a -m 'add baz'
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
    84
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
    85
git checkout master >/dev/null 2>/dev/null
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
    86
git pull --no-commit . Bar Baz > /dev/null 2>/dev/null
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
    87
commit -m 'Octopus merge'
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
    88
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
    89
echo bar >> bar
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
    90
commit -a -m 'change bar'
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
    91
9434
f5ce9b052747 test-convert-git: Use ~ instead of ^
Mads Kiilerich <mads@kiilerich.com>
parents: 8691
diff changeset
    92
git checkout -b Foo HEAD~ >/dev/null 2>/dev/null
5380
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
    93
echo >> foo
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
    94
commit -a -m 'change foo'
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
    95
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
    96
git checkout master >/dev/null 2>/dev/null
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
    97
git pull --no-commit -s ours . Foo > /dev/null 2>/dev/null
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
    98
commit -m 'Discard change to foo'
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
    99
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
   100
cd ..
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
   101
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
   102
glog()
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
   103
{
8523
5b7da468531b tests: replace #...# syntax with {...}
Martin Geisler <mg@lazybytes.net>
parents: 8271
diff changeset
   104
    hg glog --template '{rev} "{desc|firstline}" files: {files}\n' "$@"
5380
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
   105
}
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
   106
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
   107
splitrepo()
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
   108
{
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
   109
    msg="$1"
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
   110
    files="$2"
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
   111
    opts=$3
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
   112
    echo "% $files: $msg"
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
   113
    prefix=`echo "$files" | sed -e 's/ /-/g'`
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
   114
    fmap="$prefix.fmap"
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
   115
    repo="$prefix.repo"
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
   116
    for i in $files; do
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
   117
	echo "include $i" >> "$fmap"
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
   118
    done
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
   119
    hg -q convert $opts --filemap "$fmap" --datesort git-repo2 "$repo"
6737
7239e06e58e9 context: consistently return p1 context for None
Matt Mackall <mpm@selenic.com>
parents: 5380
diff changeset
   120
    hg up -q -R "$repo"
5380
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
   121
    glog -R "$repo"
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
   122
    hg -R "$repo" manifest --debug
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
   123
}
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
   124
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
   125
echo '% full conversion'
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
   126
hg -q convert --datesort git-repo2 fullrepo
6737
7239e06e58e9 context: consistently return p1 context for None
Matt Mackall <mpm@selenic.com>
parents: 5380
diff changeset
   127
hg up -q -R fullrepo
5380
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
   128
glog -R fullrepo
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
   129
hg -R fullrepo manifest --debug
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
   130
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
   131
splitrepo 'octopus merge' 'foo bar baz'
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
   132
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
   133
splitrepo 'only some parents of an octopus merge; "discard" a head' 'foo baz quux'
a5a7f7fd5554 convert_git: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5369
diff changeset
   134
7222
c1dc903dc7b6 convert: read git output in binary mode under Windows (issue 1359)
Patrick Mezard <pmezard@gmail.com>
parents: 5380
diff changeset
   135
echo
c1dc903dc7b6 convert: read git output in binary mode under Windows (issue 1359)
Patrick Mezard <pmezard@gmail.com>
parents: 5380
diff changeset
   136
echo '% test binary conversion (issue 1359)'
c1dc903dc7b6 convert: read git output in binary mode under Windows (issue 1359)
Patrick Mezard <pmezard@gmail.com>
parents: 5380
diff changeset
   137
mkdir git-repo3
c1dc903dc7b6 convert: read git output in binary mode under Windows (issue 1359)
Patrick Mezard <pmezard@gmail.com>
parents: 5380
diff changeset
   138
cd git-repo3
c1dc903dc7b6 convert: read git output in binary mode under Windows (issue 1359)
Patrick Mezard <pmezard@gmail.com>
parents: 5380
diff changeset
   139
git init-db >/dev/null 2>/dev/null
c1dc903dc7b6 convert: read git output in binary mode under Windows (issue 1359)
Patrick Mezard <pmezard@gmail.com>
parents: 5380
diff changeset
   140
python -c 'file("b", "wb").write("".join([chr(i) for i in range(256)])*16)'
c1dc903dc7b6 convert: read git output in binary mode under Windows (issue 1359)
Patrick Mezard <pmezard@gmail.com>
parents: 5380
diff changeset
   141
git add b
c1dc903dc7b6 convert: read git output in binary mode under Windows (issue 1359)
Patrick Mezard <pmezard@gmail.com>
parents: 5380
diff changeset
   142
commit -a -m addbinary
c1dc903dc7b6 convert: read git output in binary mode under Windows (issue 1359)
Patrick Mezard <pmezard@gmail.com>
parents: 5380
diff changeset
   143
cd ..
c1dc903dc7b6 convert: read git output in binary mode under Windows (issue 1359)
Patrick Mezard <pmezard@gmail.com>
parents: 5380
diff changeset
   144
c1dc903dc7b6 convert: read git output in binary mode under Windows (issue 1359)
Patrick Mezard <pmezard@gmail.com>
parents: 5380
diff changeset
   145
echo '% convert binary file'
c1dc903dc7b6 convert: read git output in binary mode under Windows (issue 1359)
Patrick Mezard <pmezard@gmail.com>
parents: 5380
diff changeset
   146
hg convert git-repo3 git-repo3-hg
c1dc903dc7b6 convert: read git output in binary mode under Windows (issue 1359)
Patrick Mezard <pmezard@gmail.com>
parents: 5380
diff changeset
   147
c1dc903dc7b6 convert: read git output in binary mode under Windows (issue 1359)
Patrick Mezard <pmezard@gmail.com>
parents: 5380
diff changeset
   148
cd git-repo3-hg
c1dc903dc7b6 convert: read git output in binary mode under Windows (issue 1359)
Patrick Mezard <pmezard@gmail.com>
parents: 5380
diff changeset
   149
hg up -C
c1dc903dc7b6 convert: read git output in binary mode under Windows (issue 1359)
Patrick Mezard <pmezard@gmail.com>
parents: 5380
diff changeset
   150
python -c 'print len(file("b", "rb").read())'
8271
e3d3dad805f9 Add committer tag only when needed in git conversion
Richard Quirk <richard.quirk@gmail.com>
parents: 7223
diff changeset
   151
cd ..
7222
c1dc903dc7b6 convert: read git output in binary mode under Windows (issue 1359)
Patrick Mezard <pmezard@gmail.com>
parents: 5380
diff changeset
   152
8271
e3d3dad805f9 Add committer tag only when needed in git conversion
Richard Quirk <richard.quirk@gmail.com>
parents: 7223
diff changeset
   153
echo
e3d3dad805f9 Add committer tag only when needed in git conversion
Richard Quirk <richard.quirk@gmail.com>
parents: 7223
diff changeset
   154
echo '% test author vs committer'
e3d3dad805f9 Add committer tag only when needed in git conversion
Richard Quirk <richard.quirk@gmail.com>
parents: 7223
diff changeset
   155
mkdir git-repo4
e3d3dad805f9 Add committer tag only when needed in git conversion
Richard Quirk <richard.quirk@gmail.com>
parents: 7223
diff changeset
   156
cd git-repo4
e3d3dad805f9 Add committer tag only when needed in git conversion
Richard Quirk <richard.quirk@gmail.com>
parents: 7223
diff changeset
   157
git init-db >/dev/null 2>/dev/null
e3d3dad805f9 Add committer tag only when needed in git conversion
Richard Quirk <richard.quirk@gmail.com>
parents: 7223
diff changeset
   158
echo >> foo
e3d3dad805f9 Add committer tag only when needed in git conversion
Richard Quirk <richard.quirk@gmail.com>
parents: 7223
diff changeset
   159
git add foo
e3d3dad805f9 Add committer tag only when needed in git conversion
Richard Quirk <richard.quirk@gmail.com>
parents: 7223
diff changeset
   160
commit -a -m addfoo
e3d3dad805f9 Add committer tag only when needed in git conversion
Richard Quirk <richard.quirk@gmail.com>
parents: 7223
diff changeset
   161
echo >> foo
e3d3dad805f9 Add committer tag only when needed in git conversion
Richard Quirk <richard.quirk@gmail.com>
parents: 7223
diff changeset
   162
GIT_AUTHOR_NAME="nottest"
e3d3dad805f9 Add committer tag only when needed in git conversion
Richard Quirk <richard.quirk@gmail.com>
parents: 7223
diff changeset
   163
commit -a -m addfoo2
e3d3dad805f9 Add committer tag only when needed in git conversion
Richard Quirk <richard.quirk@gmail.com>
parents: 7223
diff changeset
   164
cd ..
e3d3dad805f9 Add committer tag only when needed in git conversion
Richard Quirk <richard.quirk@gmail.com>
parents: 7223
diff changeset
   165
e3d3dad805f9 Add committer tag only when needed in git conversion
Richard Quirk <richard.quirk@gmail.com>
parents: 7223
diff changeset
   166
echo '% convert author committer'
e3d3dad805f9 Add committer tag only when needed in git conversion
Richard Quirk <richard.quirk@gmail.com>
parents: 7223
diff changeset
   167
hg convert git-repo4 git-repo4-hg
8691
a0a541d6fed6 convert: fail fast if source does not support --sourcesort
Patrick Mezard <pmezard@gmail.com>
parents: 8523
diff changeset
   168
hg -R git-repo4-hg log -v
a0a541d6fed6 convert: fail fast if source does not support --sourcesort
Patrick Mezard <pmezard@gmail.com>
parents: 8523
diff changeset
   169
a0a541d6fed6 convert: fail fast if source does not support --sourcesort
Patrick Mezard <pmezard@gmail.com>
parents: 8523
diff changeset
   170
echo '% --sourceorder should fail'
a0a541d6fed6 convert: fail fast if source does not support --sourcesort
Patrick Mezard <pmezard@gmail.com>
parents: 8523
diff changeset
   171
hg convert --sourcesort git-repo4 git-repo4-sourcesort-hg
a0a541d6fed6 convert: fail fast if source does not support --sourcesort
Patrick Mezard <pmezard@gmail.com>
parents: 8523
diff changeset
   172
10987
b3af02b1f19f convert/git: check status when reading output stream
Patrick Mezard <pmezard@gmail.com>
parents: 9434
diff changeset
   173
echo '% damage git repository and convert again'
b3af02b1f19f convert/git: check status when reading output stream
Patrick Mezard <pmezard@gmail.com>
parents: 9434
diff changeset
   174
cat > damage.py <<EOF
b3af02b1f19f convert/git: check status when reading output stream
Patrick Mezard <pmezard@gmail.com>
parents: 9434
diff changeset
   175
import os
b3af02b1f19f convert/git: check status when reading output stream
Patrick Mezard <pmezard@gmail.com>
parents: 9434
diff changeset
   176
for root, dirs, files in os.walk('git-repo4/.git/objects'):
b3af02b1f19f convert/git: check status when reading output stream
Patrick Mezard <pmezard@gmail.com>
parents: 9434
diff changeset
   177
    if files:
b3af02b1f19f convert/git: check status when reading output stream
Patrick Mezard <pmezard@gmail.com>
parents: 9434
diff changeset
   178
        path = os.path.join(root, files[0])
b3af02b1f19f convert/git: check status when reading output stream
Patrick Mezard <pmezard@gmail.com>
parents: 9434
diff changeset
   179
        os.remove(path)
b3af02b1f19f convert/git: check status when reading output stream
Patrick Mezard <pmezard@gmail.com>
parents: 9434
diff changeset
   180
        break
b3af02b1f19f convert/git: check status when reading output stream
Patrick Mezard <pmezard@gmail.com>
parents: 9434
diff changeset
   181
EOF
b3af02b1f19f convert/git: check status when reading output stream
Patrick Mezard <pmezard@gmail.com>
parents: 9434
diff changeset
   182
python damage.py
b3af02b1f19f convert/git: check status when reading output stream
Patrick Mezard <pmezard@gmail.com>
parents: 9434
diff changeset
   183
hg convert git-repo4 git-repo4-broken-hg 2>&1 | \
10990
bb377a311109 test-convert-git: be tolerant to git output variants
Patrick Mezard <pmezard@gmail.com>
parents: 10987
diff changeset
   184
    grep 'abort:' | sed 's/abort:.*/abort:/g'
10987
b3af02b1f19f convert/git: check status when reading output stream
Patrick Mezard <pmezard@gmail.com>
parents: 9434
diff changeset
   185
8691
a0a541d6fed6 convert: fail fast if source does not support --sourcesort
Patrick Mezard <pmezard@gmail.com>
parents: 8523
diff changeset
   186
true