tests/test-rebase-rename
author Brendan Cully <brendan@kublai.com>
Mon, 29 Jun 2009 09:00:37 -0700
changeset 8960 8a5657ecdaaf
parent 7954 b969611064ae
child 11198 b345b1cc124f
permissions -rwxr-xr-x
Merge with crew
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7954
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
     1
#!/bin/sh
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
     2
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
     3
echo "[extensions]" >> $HGRCPATH
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
     4
echo "rebase=" >> $HGRCPATH
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
     5
echo "[diff]" >> $HGRCPATH
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
     6
echo "git=1" >> $HGRCPATH
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
     7
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
     8
BASE=`pwd`
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
     9
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    10
cleanoutput () {
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    11
    sed -e 's/\(Rebase status stored to\).*/\1/'  \
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    12
        -e 's/\(Rebase status restored from\).*/\1/' \
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    13
        -e 's/\(saving bundle to \).*/\1/'
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    14
}
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    15
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    16
hg init repo1
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    17
cd repo1
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    18
echo "a">a
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    19
hg commit -Am "A" --date '0 0'
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    20
echo "b"> b
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    21
hg commit -Am "B" --date '1 0'
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    22
hg up -C 0
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    23
hg mv a a-renamed
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    24
hg commit -m 'rename A' --date '2 0'
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    25
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    26
echo
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    27
echo '% Rename is tracked'
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    28
hg log -p -r tip --template '{rev}:{desc}\n'
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    29
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    30
echo '% Rebase the revision containing the rename'
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    31
hg rebase -s 2 -d 1 --quiet 2>&1 | cleanoutput
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    32
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    33
echo
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    34
echo '% Rename is not lost'
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    35
hg log -p -r tip --template '{rev}:{desc}\n'
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    36
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    37
cd $BASE
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    38
rm -rf repo1
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    39
hg init repo1
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    40
cd repo1
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    41
echo "a">a
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    42
hg commit -Am "A" --date '0 0'
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    43
echo "b"> b
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    44
hg commit -Am "B" --date '1 0'
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    45
hg up -C 0
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    46
hg cp a a-copied
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    47
hg commit -m 'copy A' --date '2 0'
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    48
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    49
echo
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    50
echo '% Copy is tracked'
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    51
hg log -p -r tip --template '{rev}:{desc}\n'
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    52
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    53
echo '% Rebase the revision containing the copy'
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    54
hg rebase -s 2 -d 1 --quiet 2>&1 | cleanoutput
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    55
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    56
echo
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    57
echo '% Copy is not lost'
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    58
hg log -p -r tip --template '{rev}:{desc}\n'
b969611064ae rebase: don't lose rename/copy data (Issue1423)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
    59