tests/test-branch-option.t
author Simon Sapin <simon.sapin@octobus.net>
Fri, 30 Apr 2021 19:57:46 +0200
changeset 47124 cd8ca38fccff
parent 45906 95c4cca641f6
child 48368 8c4881c07f57
permissions -rw-r--r--
rust: Use `&HgPath` instead of `&HgPathBuf` in may APIs Getting the former (through `Deref`) is almost the only useful thing one can do with the latter anyway. With this changes, API become more flexible for the "provider" of these paths which may store something else that Deref’s to HgPath, such as `std::borrow::Cow<HgPath>`. Using `Cow` can help reduce memory alloactions and copying. Differential Revision: https://phab.mercurial-scm.org/D10558
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11869
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
     1
test branch selection options
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
     2
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
     3
  $ hg init branch
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
     4
  $ cd branch
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
     5
  $ hg branch a
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
     6
  marked working directory as branch a
15615
41885892796e branch: warn on branching
Matt Mackall <mpm@selenic.com>
parents: 12942
diff changeset
     7
  (branches are permanent and global, did you want a bookmark?)
11869
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
     8
  $ echo a > foo
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
     9
  $ hg ci -d '0 0' -Ama
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    10
  adding foo
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    11
  $ echo a2 > foo
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    12
  $ hg ci -d '0 0' -ma2
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    13
  $ hg up 0
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    14
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    15
  $ hg branch c
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    16
  marked working directory as branch c
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    17
  $ echo c > foo
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    18
  $ hg ci -d '0 0' -mc
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    19
  $ hg tag -l z
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    20
  $ cd ..
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    21
  $ hg clone -r 0 branch branch2
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    22
  adding changesets
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    23
  adding manifests
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    24
  adding file changes
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    25
  added 1 changesets with 1 changes to 1 files
34661
eb586ed5d8ce transaction-summary: show the range of new revisions upon pull/unbundle (BC)
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 25295
diff changeset
    26
  new changesets 5b65ba7c951d
11869
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    27
  updating to branch a
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    28
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    29
  $ cd branch2
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    30
  $ hg up 0
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    31
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    32
  $ hg branch b
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    33
  marked working directory as branch b
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    34
  $ echo b > foo
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    35
  $ hg ci -d '0 0' -mb
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    36
  $ hg up 0
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    37
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    38
  $ hg --encoding utf-8 branch æ
12942
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12847
diff changeset
    39
  marked working directory as branch \xc3\xa6 (esc)
11869
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    40
  $ echo ae1 > foo
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    41
  $ hg ci -d '0 0' -mae1
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    42
  $ hg up 0
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    43
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    44
  $ hg --encoding utf-8 branch -f æ
12942
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12847
diff changeset
    45
  marked working directory as branch \xc3\xa6 (esc)
11869
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    46
  $ echo ae2 > foo
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    47
  $ hg ci -d '0 0' -mae2
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    48
  created new head
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    49
  $ hg up 0
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    50
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    51
  $ hg branch -f b
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    52
  marked working directory as branch b
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    53
  $ echo b2 > foo
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    54
  $ hg ci -d '0 0' -mb2
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    55
  created new head
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    56
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    57
unknown branch and fallback
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    58
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    59
  $ hg in -qbz
45906
95c4cca641f6 errors: remove trailing "!" from some error messages for consistency
Martin von Zweigbergk <martinvonz@google.com>
parents: 34661
diff changeset
    60
  abort: unknown branch 'z'
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 11869
diff changeset
    61
  [255]
11869
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    62
  $ hg in -q ../branch#z
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    63
  2:f25d57ab0566
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    64
  $ hg out -qbz
45906
95c4cca641f6 errors: remove trailing "!" from some error messages for consistency
Martin von Zweigbergk <martinvonz@google.com>
parents: 34661
diff changeset
    65
  abort: unknown branch 'z'
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 11869
diff changeset
    66
  [255]
10365
d757bc0c7865 interpret repo#name url syntax as branch instead of revision
Sune Foldager <cryo@cyanite.org>
parents:
diff changeset
    67
11869
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    68
in rev c branch a
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    69
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    70
  $ hg in -qr c ../branch#a
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    71
  1:dd6e60a716c6
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    72
  2:f25d57ab0566
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    73
  $ hg in -qr c -b a
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    74
  1:dd6e60a716c6
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    75
  2:f25d57ab0566
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    76
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    77
out branch .
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    78
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    79
  $ hg out -q ../branch#.
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    80
  1:b84708d77ab7
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    81
  4:65511d0e2b55
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    82
  $ hg out -q -b .
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    83
  1:b84708d77ab7
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    84
  4:65511d0e2b55
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    85
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    86
out branch . non-ascii
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    87
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    88
  $ hg --encoding utf-8 up æ
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    89
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    90
  $ hg --encoding latin1 out -q ../branch#.
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    91
  2:df5a44224d4e
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    92
  3:4f4a5125ca10
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    93
  $ hg --encoding latin1 out -q -b .
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    94
  2:df5a44224d4e
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    95
  3:4f4a5125ca10
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    96
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    97
clone branch b
10365
d757bc0c7865 interpret repo#name url syntax as branch instead of revision
Sune Foldager <cryo@cyanite.org>
parents:
diff changeset
    98
11869
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    99
  $ cd ..
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   100
  $ hg clone branch2#b branch3
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   101
  adding changesets
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   102
  adding manifests
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   103
  adding file changes
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   104
  added 3 changesets with 3 changes to 1 files (+1 heads)
34661
eb586ed5d8ce transaction-summary: show the range of new revisions upon pull/unbundle (BC)
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 25295
diff changeset
   105
  new changesets 5b65ba7c951d:65511d0e2b55
11869
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   106
  updating to branch b
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   107
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   108
  $ hg -q -R branch3 heads b
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   109
  2:65511d0e2b55
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   110
  1:b84708d77ab7
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   111
  $ hg -q -R branch3 parents
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   112
  2:65511d0e2b55
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   113
  $ rm -rf branch3
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   114
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   115
clone rev a branch b
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   116
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   117
  $ hg clone -r a branch2#b branch3
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   118
  adding changesets
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   119
  adding manifests
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   120
  adding file changes
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   121
  added 3 changesets with 3 changes to 1 files (+1 heads)
34661
eb586ed5d8ce transaction-summary: show the range of new revisions upon pull/unbundle (BC)
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 25295
diff changeset
   122
  new changesets 5b65ba7c951d:65511d0e2b55
11869
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   123
  updating to branch a
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   124
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   125
  $ hg -q -R branch3 heads b
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   126
  2:65511d0e2b55
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   127
  1:b84708d77ab7
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   128
  $ hg -q -R branch3 parents
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   129
  0:5b65ba7c951d
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   130
  $ rm -rf branch3