tests/test-convert-hg-startrev
author David Soria Parra <dsp@php.net>
Sun, 07 Dec 2008 08:47:02 +0100
changeset 7485 ecfb683675ed
parent 6885 6e253aa04ff7
child 8523 5b7da468531b
permissions -rwxr-xr-x
Merge bookmarks
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6885
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     1
#!/bin/sh
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     2
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     3
echo '[extensions]' >> $HGRCPATH
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     4
echo 'hgext.graphlog =' >> $HGRCPATH
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     5
echo 'hgext.convert =' >> $HGRCPATH
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     6
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     7
glog()
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     8
{
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     9
    hg -R "$1" glog --template '#rev# "#desc#" files: #files#\n'
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    10
}
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    11
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    12
hg init source
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    13
cd source
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    14
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    15
echo a > a
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    16
echo b > b
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    17
hg ci -d '0 0' -qAm '0: add a b'
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    18
echo c > c
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    19
hg ci -d '1 0' -qAm '1: add c'
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    20
hg copy a e
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    21
echo b >> b
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    22
hg ci -d '2 0' -qAm '2: copy e from a, change b'
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    23
hg up -C 0
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    24
echo a >> a
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    25
hg ci -d '3 0' -qAm '3: change a'
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    26
hg merge
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    27
hg copy b d
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    28
hg ci -d '4 0' -qAm '4: merge 2 and 3, copy d from b'
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    29
echo a >> a
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    30
hg ci -d '5 0' -qAm '5: change a'
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    31
cd ..
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    32
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    33
echo % convert from null revision
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    34
hg convert --config convert.hg.startrev=null source empty
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    35
glog empty
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    36
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    37
echo % convert from zero revision
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    38
hg convert --config convert.hg.startrev=0 source full
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    39
glog full
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    40
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    41
echo % convert from merge parent
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    42
hg convert --config convert.hg.startrev=1 source conv1
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    43
glog conv1
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    44
cd conv1
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    45
echo % check copy preservation
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    46
hg log --follow --copies e
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    47
echo % check copy removal on missing parent
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    48
hg log --follow --copies d
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    49
hg cat -r tip a b
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    50
hg -q verify
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    51
cd ..
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    52
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    53
echo % convert from merge
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    54
hg convert --config convert.hg.startrev=4 source conv4
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    55
glog conv4
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    56
cd conv4
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    57
hg up -C
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    58
hg cat -r tip a b
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    59
hg -q verify
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    60
cd ..
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    61