Mercurial > hg > mercurial-crew-with-dirclash
annotate tests/test-parents @ 5378:8a2915f57dfc
convert: add a mode where mercurial_sink skips empty revisions.
The getchanges function of some converter_source classes can return
some false positives. I.e. they sometimes claim that a file "foo"
was changed in some revision, even though its contents are still the
same.
convert_svn is particularly bad, but I think this can also happen with
convert_cvs and, at least in theory, with mercurial_source.
For regular conversions this is not really a problem - as long as
getfile returns the right contents, we'll get a converted revision
with the right contents. But when we use --filemap, this could lead
to superfluous revisions being converted.
Instead of fixing every converter_source, I decided to change
mercurial_sink to work around this problem.
When --filemap is used, we're interested only in revisions that touch
some specific files. If a revision doesn't change any of these files,
then we're not interested in it (at least for revisions with a single
parent; merges are special).
For mercurial_sink, we abuse this property and rollback a commit if
the manifest text hasn't changed. This avoids duplicating the logic
from localrepo.filecommit to detect unchanged files.
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Thu, 04 Oct 2007 23:21:37 -0300 |
parents | 5a4824f6665c |
children |
rev | line source |
---|---|
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 |