tests/test-branch-option.t
author Yuya Nishihara <yuya@tcha.org>
Sun, 24 Apr 2016 18:41:23 +0900
changeset 34330 89aec1834a86
parent 25295 701df761aa94
child 34661 eb586ed5d8ce
permissions -rw-r--r--
templatekw: add new-style template expansion to {manifest} The goal is to allow us to easily access to nested data. The dot operator will be introduced later so we can write '{p1.files}' instead of '{revset("p1()") % "{files}"}' for example. In the example above, 'p1' needs to carry a mapping dict along with its string representation. If it were a list or a dict, it could be wrapped semi-transparently with the _hybrid class, but for non-list/dict types, it would be difficult to proxy all necessary functions to underlying value type because several core operations may conflict with the ones of the underlying value: - hash(value) should be different from hash(wrapped(value)), which means dict[wrapped(value)] would be invalid - 'value == wrapped(value)' would be false, breaks 'ifcontains' - len(wrapped(value)) may be either len(value) or len(iter(wrapped(value))) So the wrapper has no proxy functions and its scope designed to be minimal. It's unwrapped at eval*() functions so we don't have to care for a wrapped object unless it's really needed: # most template functions just call evalfuncarg() unwrapped_value = evalfuncarg(context, mapping, args[n]) # if wrapped value is needed, use evalrawexp() maybe_wrapped_value = evalrawexp(context, mapping, args[n]) Another idea was to wrap every template variable with a tagging class, but which seemed uneasy without a static type checker. This patch updates {manifest} to a mappable as an example.
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
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    26
  updating to branch a
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    27
  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
    28
  $ cd branch2
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    29
  $ hg up 0
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    30
  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
    31
  $ hg branch b
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    32
  marked working directory as branch b
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    33
  $ echo b > foo
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    34
  $ hg ci -d '0 0' -mb
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    35
  $ hg up 0
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    36
  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
    37
  $ 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
    38
  marked working directory as branch \xc3\xa6 (esc)
11869
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    39
  $ echo ae1 > foo
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    40
  $ hg ci -d '0 0' -mae1
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    41
  $ hg up 0
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    42
  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
    43
  $ 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
    44
  marked working directory as branch \xc3\xa6 (esc)
11869
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    45
  $ echo ae2 > foo
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    46
  $ hg ci -d '0 0' -mae2
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    47
  created new head
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    48
  $ hg up 0
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    49
  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
    50
  $ hg branch -f b
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    51
  marked working directory as branch b
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    52
  $ echo b2 > foo
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    53
  $ hg ci -d '0 0' -mb2
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    54
  created new head
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    55
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    56
unknown branch and fallback
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    57
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    58
  $ hg in -qbz
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    59
  abort: unknown branch 'z'!
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 11869
diff changeset
    60
  [255]
11869
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    61
  $ hg in -q ../branch#z
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    62
  2:f25d57ab0566
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    63
  $ hg out -qbz
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    64
  abort: unknown branch 'z'!
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 11869
diff changeset
    65
  [255]
10365
d757bc0c7865 interpret repo#name url syntax as branch instead of revision
Sune Foldager <cryo@cyanite.org>
parents:
diff changeset
    66
11869
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    67
in rev c branch a
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    68
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    69
  $ hg in -qr c ../branch#a
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    70
  1:dd6e60a716c6
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    71
  2:f25d57ab0566
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    72
  $ hg in -qr c -b a
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    73
  1:dd6e60a716c6
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    74
  2:f25d57ab0566
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    75
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    76
out branch .
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    77
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    78
  $ hg out -q ../branch#.
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    79
  1:b84708d77ab7
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    80
  4:65511d0e2b55
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    81
  $ hg out -q -b .
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    82
  1:b84708d77ab7
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    83
  4:65511d0e2b55
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    84
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    85
out branch . non-ascii
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    86
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    87
  $ hg --encoding utf-8 up æ
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    88
  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
    89
  $ hg --encoding latin1 out -q ../branch#.
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    90
  2:df5a44224d4e
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    91
  3:4f4a5125ca10
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    92
  $ hg --encoding latin1 out -q -b .
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    93
  2:df5a44224d4e
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    94
  3:4f4a5125ca10
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    95
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    96
clone branch b
10365
d757bc0c7865 interpret repo#name url syntax as branch instead of revision
Sune Foldager <cryo@cyanite.org>
parents:
diff changeset
    97
11869
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    98
  $ cd ..
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
    99
  $ hg clone branch2#b branch3
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   100
  adding changesets
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   101
  adding manifests
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   102
  adding file changes
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   103
  added 3 changesets with 3 changes to 1 files (+1 heads)
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   104
  updating to branch b
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   105
  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
   106
  $ hg -q -R branch3 heads b
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   107
  2:65511d0e2b55
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   108
  1:b84708d77ab7
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   109
  $ hg -q -R branch3 parents
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   110
  2:65511d0e2b55
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   111
  $ rm -rf branch3
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   112
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   113
clone rev a branch b
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
  $ hg clone -r a branch2#b branch3
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   116
  adding changesets
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   117
  adding manifests
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   118
  adding file changes
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   119
  added 3 changesets with 3 changes to 1 files (+1 heads)
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   120
  updating to branch a
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   121
  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
   122
  $ hg -q -R branch3 heads b
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   123
  2:65511d0e2b55
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   124
  1:b84708d77ab7
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   125
  $ hg -q -R branch3 parents
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   126
  0:5b65ba7c951d
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
   127
  $ rm -rf branch3