tests/test-url-rev
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
Thu, 04 Oct 2007 23:21:37 -0300
changeset 5378 8a2915f57dfc
parent 5238 20817af258d8
permissions -rwxr-xr-x
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.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5236
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     1
#!/bin/sh
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     2
# test basic functionality of url#rev syntax
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     3
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     4
hg init repo
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     5
cd repo
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     6
echo a > a
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     7
hg ci -qAm 'add a' -d '0 0'
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     8
hg branch foo
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     9
echo >> a
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    10
hg ci -m 'change a' -d '0 0'
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    11
cd ..
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    12
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    13
echo '% clone repo#foo'
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    14
hg clone 'repo#foo' clone
5237
fe55e3d6dc0b clone: if "url#rev" was given, update to rev
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5236
diff changeset
    15
echo '% heads'
5236
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    16
hg --cwd clone heads
5237
fe55e3d6dc0b clone: if "url#rev" was given, update to rev
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5236
diff changeset
    17
echo '% parents'
fe55e3d6dc0b clone: if "url#rev" was given, update to rev
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5236
diff changeset
    18
hg --cwd clone parents
5236
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    19
sed -e 's/default.*#/default = #/' clone/.hg/hgrc
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    20
echo
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    21
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    22
echo '% changing original repo'
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    23
cd repo
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    24
echo >> a
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    25
hg ci -m 'new head of branch foo' -d '0 0'
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    26
hg up -qC default
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    27
echo bar > bar
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    28
hg ci -qAm 'add bar' -d '0 0'
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    29
hg log
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    30
echo
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    31
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    32
echo '% outgoing'
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    33
hg -q outgoing '../clone#foo'
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    34
echo
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    35
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    36
echo '% push'
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    37
hg -q push '../clone#foo'
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    38
hg --cwd ../clone heads
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    39
cd ..
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    40
echo
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    41
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    42
echo '% rolling back'
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    43
cd clone
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    44
hg rollback
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    45
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    46
echo '% incoming'
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    47
hg -q incoming
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    48
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    49
echo '% pull'
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    50
hg -q pull
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    51
hg heads
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    52
echo
cbe6e263357b parseurl: also return the revision after the "#"; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    53
5238
20817af258d8 pull -u: if "url#rev" was given, update to rev
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5237
diff changeset
    54
echo '% pull should not have updated'
20817af258d8 pull -u: if "url#rev" was given, update to rev
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5237
diff changeset
    55
hg parents -q
20817af258d8 pull -u: if "url#rev" was given, update to rev
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5237
diff changeset
    56
echo '% going back to the default branch'
20817af258d8 pull -u: if "url#rev" was given, update to rev
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5237
diff changeset
    57
hg up -C 0
20817af258d8 pull -u: if "url#rev" was given, update to rev
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5237
diff changeset
    58
hg parents
20817af258d8 pull -u: if "url#rev" was given, update to rev
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5237
diff changeset
    59
echo '% no new revs, no update'
20817af258d8 pull -u: if "url#rev" was given, update to rev
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5237
diff changeset
    60
hg pull -qu
20817af258d8 pull -u: if "url#rev" was given, update to rev
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5237
diff changeset
    61
hg parents -q
20817af258d8 pull -u: if "url#rev" was given, update to rev
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5237
diff changeset
    62
echo '% rollback'
20817af258d8 pull -u: if "url#rev" was given, update to rev
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5237
diff changeset
    63
hg rollback
20817af258d8 pull -u: if "url#rev" was given, update to rev
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5237
diff changeset
    64
hg up -C 0
20817af258d8 pull -u: if "url#rev" was given, update to rev
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5237
diff changeset
    65
hg parents -q
20817af258d8 pull -u: if "url#rev" was given, update to rev
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5237
diff changeset
    66
echo '% pull -u takes us back to branch foo'
20817af258d8 pull -u: if "url#rev" was given, update to rev
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5237
diff changeset
    67
hg pull -qu
20817af258d8 pull -u: if "url#rev" was given, update to rev
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5237
diff changeset
    68
hg parents
20817af258d8 pull -u: if "url#rev" was given, update to rev
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5237
diff changeset
    69
20817af258d8 pull -u: if "url#rev" was given, update to rev
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5237
diff changeset
    70
echo '% rollback'
20817af258d8 pull -u: if "url#rev" was given, update to rev
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5237
diff changeset
    71
hg rollback
20817af258d8 pull -u: if "url#rev" was given, update to rev
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5237
diff changeset
    72
hg up -C 0
20817af258d8 pull -u: if "url#rev" was given, update to rev
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5237
diff changeset
    73
echo '% parents'
20817af258d8 pull -u: if "url#rev" was given, update to rev
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5237
diff changeset
    74
hg parents -q
20817af258d8 pull -u: if "url#rev" was given, update to rev
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5237
diff changeset
    75
echo '% heads'
20817af258d8 pull -u: if "url#rev" was given, update to rev
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5237
diff changeset
    76
hg heads -q
20817af258d8 pull -u: if "url#rev" was given, update to rev
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5237
diff changeset
    77
echo '% pull -u -r otherrev url#rev updates to rev'
20817af258d8 pull -u: if "url#rev" was given, update to rev
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5237
diff changeset
    78
hg pull -qur default default
20817af258d8 pull -u: if "url#rev" was given, update to rev
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5237
diff changeset
    79
echo '% parents'
20817af258d8 pull -u: if "url#rev" was given, update to rev
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5237
diff changeset
    80
hg parents
20817af258d8 pull -u: if "url#rev" was given, update to rev
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5237
diff changeset
    81
echo '% heads'
20817af258d8 pull -u: if "url#rev" was given, update to rev
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5237
diff changeset
    82
hg heads
20817af258d8 pull -u: if "url#rev" was given, update to rev
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5237
diff changeset
    83