tests/test-parents
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
Wed, 26 Sep 2007 01:58:45 -0300
changeset 5338 f87685355c9c
parent 5299 5a4824f6665c
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:
4584
0d26e3d0eeeb Make parents with a file but not a revision use working directory revision.
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     1
#!/bin/sh
0d26e3d0eeeb Make parents with a file but not a revision use working directory revision.
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     2
# test parents command
0d26e3d0eeeb Make parents with a file but not a revision use working directory revision.
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     3
4894
be5dc5e3ab2d hg parents: don't pass an OS-specific path to repo.filectx
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4584
diff changeset
     4
hg init repo
be5dc5e3ab2d hg parents: don't pass an OS-specific path to repo.filectx
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4584
diff changeset
     5
cd repo
4584
0d26e3d0eeeb Make parents with a file but not a revision use working directory revision.
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     6
echo % no working directory
0d26e3d0eeeb Make parents with a file but not a revision use working directory revision.
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     7
hg parents
0d26e3d0eeeb Make parents with a file but not a revision use working directory revision.
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     8
0d26e3d0eeeb Make parents with a file but not a revision use working directory revision.
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     9
echo a > a
0d26e3d0eeeb Make parents with a file but not a revision use working directory revision.
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    10
echo b > b
0d26e3d0eeeb Make parents with a file but not a revision use working directory revision.
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    11
hg ci -Amab -d '0 0'
0d26e3d0eeeb Make parents with a file but not a revision use working directory revision.
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    12
echo a >> a
0d26e3d0eeeb Make parents with a file but not a revision use working directory revision.
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    13
hg ci -Ama -d '1 0'
0d26e3d0eeeb Make parents with a file but not a revision use working directory revision.
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    14
echo b >> b
0d26e3d0eeeb Make parents with a file but not a revision use working directory revision.
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    15
hg ci -Amb -d '2 0'
5299
5a4824f6665c Test parents behaviour with files.
Patrick Mezard <pmezard@gmail.com>
parents: 4894
diff changeset
    16
echo c > c
5a4824f6665c Test parents behaviour with files.
Patrick Mezard <pmezard@gmail.com>
parents: 4894
diff changeset
    17
hg ci -Amc -d '3 0'
5a4824f6665c Test parents behaviour with files.
Patrick Mezard <pmezard@gmail.com>
parents: 4894
diff changeset
    18
hg up -C 1
5a4824f6665c Test parents behaviour with files.
Patrick Mezard <pmezard@gmail.com>
parents: 4894
diff changeset
    19
echo d > c
5a4824f6665c Test parents behaviour with files.
Patrick Mezard <pmezard@gmail.com>
parents: 4894
diff changeset
    20
hg ci -Amc2 -d '4 0'
5a4824f6665c Test parents behaviour with files.
Patrick Mezard <pmezard@gmail.com>
parents: 4894
diff changeset
    21
hg up -C 3
4584
0d26e3d0eeeb Make parents with a file but not a revision use working directory revision.
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    22
0d26e3d0eeeb Make parents with a file but not a revision use working directory revision.
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    23
echo % hg parents
0d26e3d0eeeb Make parents with a file but not a revision use working directory revision.
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    24
hg parents
0d26e3d0eeeb Make parents with a file but not a revision use working directory revision.
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    25
0d26e3d0eeeb Make parents with a file but not a revision use working directory revision.
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    26
echo % hg parents a
0d26e3d0eeeb Make parents with a file but not a revision use working directory revision.
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    27
hg parents a
0d26e3d0eeeb Make parents with a file but not a revision use working directory revision.
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    28
5299
5a4824f6665c Test parents behaviour with files.
Patrick Mezard <pmezard@gmail.com>
parents: 4894
diff changeset
    29
echo % hg parents c, single revision
5a4824f6665c Test parents behaviour with files.
Patrick Mezard <pmezard@gmail.com>
parents: 4894
diff changeset
    30
hg parents c
5a4824f6665c Test parents behaviour with files.
Patrick Mezard <pmezard@gmail.com>
parents: 4894
diff changeset
    31
5a4824f6665c Test parents behaviour with files.
Patrick Mezard <pmezard@gmail.com>
parents: 4894
diff changeset
    32
echo % hg parents -r 3 c
5a4824f6665c Test parents behaviour with files.
Patrick Mezard <pmezard@gmail.com>
parents: 4894
diff changeset
    33
hg parents -r 3 c
5a4824f6665c Test parents behaviour with files.
Patrick Mezard <pmezard@gmail.com>
parents: 4894
diff changeset
    34
4584
0d26e3d0eeeb Make parents with a file but not a revision use working directory revision.
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    35
echo % hg parents -r 2
0d26e3d0eeeb Make parents with a file but not a revision use working directory revision.
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    36
hg parents -r 2
0d26e3d0eeeb Make parents with a file but not a revision use working directory revision.
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    37
0d26e3d0eeeb Make parents with a file but not a revision use working directory revision.
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    38
echo % hg parents -r 2 a
0d26e3d0eeeb Make parents with a file but not a revision use working directory revision.
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    39
hg parents -r 2 a
4894
be5dc5e3ab2d hg parents: don't pass an OS-specific path to repo.filectx
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4584
diff changeset
    40
be5dc5e3ab2d hg parents: don't pass an OS-specific path to repo.filectx
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4584
diff changeset
    41
echo % hg parents -r 2 ../a
be5dc5e3ab2d hg parents: don't pass an OS-specific path to repo.filectx
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4584
diff changeset
    42
hg parents -r 2 ../a
be5dc5e3ab2d hg parents: don't pass an OS-specific path to repo.filectx
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4584
diff changeset
    43
be5dc5e3ab2d hg parents: don't pass an OS-specific path to repo.filectx
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4584
diff changeset
    44
echo '% cd dir; hg parents -r 2 ../a'
be5dc5e3ab2d hg parents: don't pass an OS-specific path to repo.filectx
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4584
diff changeset
    45
mkdir dir
be5dc5e3ab2d hg parents: don't pass an OS-specific path to repo.filectx
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4584
diff changeset
    46
cd dir
be5dc5e3ab2d hg parents: don't pass an OS-specific path to repo.filectx
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4584
diff changeset
    47
hg parents -r 2 ../a
be5dc5e3ab2d hg parents: don't pass an OS-specific path to repo.filectx
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4584
diff changeset
    48
be5dc5e3ab2d hg parents: don't pass an OS-specific path to repo.filectx
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4584
diff changeset
    49
echo '% hg parents -r 2 path:a'
be5dc5e3ab2d hg parents: don't pass an OS-specific path to repo.filectx
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4584
diff changeset
    50
hg parents -r 2 path:a
be5dc5e3ab2d hg parents: don't pass an OS-specific path to repo.filectx
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4584
diff changeset
    51
be5dc5e3ab2d hg parents: don't pass an OS-specific path to repo.filectx
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4584
diff changeset
    52
echo '% hg parents -r 2 glob:a'
be5dc5e3ab2d hg parents: don't pass an OS-specific path to repo.filectx
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4584
diff changeset
    53
cd ..
be5dc5e3ab2d hg parents: don't pass an OS-specific path to repo.filectx
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4584
diff changeset
    54
hg parents -r 2 glob:a
be5dc5e3ab2d hg parents: don't pass an OS-specific path to repo.filectx
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4584
diff changeset
    55
5299
5a4824f6665c Test parents behaviour with files.
Patrick Mezard <pmezard@gmail.com>
parents: 4894
diff changeset
    56
echo % merge working dir with 2 parents, hg parents c
5a4824f6665c Test parents behaviour with files.
Patrick Mezard <pmezard@gmail.com>
parents: 4894
diff changeset
    57
HGMERGE=true hg merge
5a4824f6665c Test parents behaviour with files.
Patrick Mezard <pmezard@gmail.com>
parents: 4894
diff changeset
    58
hg parents c
5a4824f6665c Test parents behaviour with files.
Patrick Mezard <pmezard@gmail.com>
parents: 4894
diff changeset
    59
5a4824f6665c Test parents behaviour with files.
Patrick Mezard <pmezard@gmail.com>
parents: 4894
diff changeset
    60
echo % merge working dir with 1 parent, hg parents
5a4824f6665c Test parents behaviour with files.
Patrick Mezard <pmezard@gmail.com>
parents: 4894
diff changeset
    61
hg up -C 2
5a4824f6665c Test parents behaviour with files.
Patrick Mezard <pmezard@gmail.com>
parents: 4894
diff changeset
    62
HGMERGE=true hg merge -r 4
5a4824f6665c Test parents behaviour with files.
Patrick Mezard <pmezard@gmail.com>
parents: 4894
diff changeset
    63
hg parents
5a4824f6665c Test parents behaviour with files.
Patrick Mezard <pmezard@gmail.com>
parents: 4894
diff changeset
    64
echo % merge working dir with 1 parent, hg parents c
5a4824f6665c Test parents behaviour with files.
Patrick Mezard <pmezard@gmail.com>
parents: 4894
diff changeset
    65
hg parents c
5a4824f6665c Test parents behaviour with files.
Patrick Mezard <pmezard@gmail.com>
parents: 4894
diff changeset
    66
4894
be5dc5e3ab2d hg parents: don't pass an OS-specific path to repo.filectx
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4584
diff changeset
    67
true