tests/test-fileset.t
author Pierre-Yves David <pierre-yves.david@octobus.net>
Thu, 04 Jan 2024 14:51:48 +0100
changeset 51339 9a1239c362ae
parent 50337 47686726545d
permissions -rw-r--r--
delta-find: split the "sparse" part of `_pre_filter_rev` in a method Since `_pre_filter_rev` contains logic from various sources of constraint, we start splitting is in subfunction to clarify and document the grouping.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
17362
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
     1
  $ fileset() {
38610
3d8ef60569d8 fileset: make debugfileset filter repository files
Yuya Nishihara <yuya@tcha.org>
parents: 38599
diff changeset
     2
  >   hg debugfileset --all-files "$@"
17362
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
     3
  > }
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
     4
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
     5
  $ hg init repo
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
     6
  $ cd repo
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
     7
  $ echo a > a1
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
     8
  $ echo a > a2
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
     9
  $ echo b > b1
17364
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
    10
  $ echo b > b2
17362
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    11
  $ hg ci -Am addfiles
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    12
  adding a1
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    13
  adding a2
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    14
  adding b1
17364
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
    15
  adding b2
17362
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    16
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    17
Test operators and basic patterns
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    18
25255
ad1d2c952889 fileset: pretty print syntax tree in debug output
Yuya Nishihara <yuya@tcha.org>
parents: 24430
diff changeset
    19
  $ fileset -v a1
34073
7bbc4e113e5f parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents: 31853
diff changeset
    20
  (symbol 'a1')
38802
f0a574dbfae9 debugfileset: add option to show matcher representation
Yuya Nishihara <yuya@tcha.org>
parents: 38801
diff changeset
    21
  * matcher:
40782
3984409e144b match: drop unnecessary wrapping of regex in group
Martin von Zweigbergk <martinvonz@google.com>
parents: 38879
diff changeset
    22
  <patternmatcher patterns='a1$'>
17362
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    23
  a1
25255
ad1d2c952889 fileset: pretty print syntax tree in debug output
Yuya Nishihara <yuya@tcha.org>
parents: 24430
diff changeset
    24
  $ fileset -v 'a*'
34073
7bbc4e113e5f parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents: 31853
diff changeset
    25
  (symbol 'a*')
38802
f0a574dbfae9 debugfileset: add option to show matcher representation
Yuya Nishihara <yuya@tcha.org>
parents: 38801
diff changeset
    26
  * matcher:
40782
3984409e144b match: drop unnecessary wrapping of regex in group
Martin von Zweigbergk <martinvonz@google.com>
parents: 38879
diff changeset
    27
  <patternmatcher patterns='a[^/]*$'>
17362
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    28
  a1
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    29
  a2
25255
ad1d2c952889 fileset: pretty print syntax tree in debug output
Yuya Nishihara <yuya@tcha.org>
parents: 24430
diff changeset
    30
  $ fileset -v '"re:a\d"'
34073
7bbc4e113e5f parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents: 31853
diff changeset
    31
  (string 're:a\\d')
38802
f0a574dbfae9 debugfileset: add option to show matcher representation
Yuya Nishihara <yuya@tcha.org>
parents: 38801
diff changeset
    32
  * matcher:
40782
3984409e144b match: drop unnecessary wrapping of regex in group
Martin von Zweigbergk <martinvonz@google.com>
parents: 38879
diff changeset
    33
  <patternmatcher patterns='a\\d'>
17362
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    34
  a1
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    35
  a2
35741
73432eee0ac4 fileset: add kind:pat operator
Yuya Nishihara <yuya@tcha.org>
parents: 35704
diff changeset
    36
  $ fileset -v '!re:"a\d"'
73432eee0ac4 fileset: add kind:pat operator
Yuya Nishihara <yuya@tcha.org>
parents: 35704
diff changeset
    37
  (not
73432eee0ac4 fileset: add kind:pat operator
Yuya Nishihara <yuya@tcha.org>
parents: 35704
diff changeset
    38
    (kindpat
73432eee0ac4 fileset: add kind:pat operator
Yuya Nishihara <yuya@tcha.org>
parents: 35704
diff changeset
    39
      (symbol 're')
73432eee0ac4 fileset: add kind:pat operator
Yuya Nishihara <yuya@tcha.org>
parents: 35704
diff changeset
    40
      (string 'a\\d')))
38802
f0a574dbfae9 debugfileset: add option to show matcher representation
Yuya Nishihara <yuya@tcha.org>
parents: 38801
diff changeset
    41
  * matcher:
f0a574dbfae9 debugfileset: add option to show matcher representation
Yuya Nishihara <yuya@tcha.org>
parents: 38801
diff changeset
    42
  <predicatenmatcher
f0a574dbfae9 debugfileset: add option to show matcher representation
Yuya Nishihara <yuya@tcha.org>
parents: 38801
diff changeset
    43
    pred=<not
40782
3984409e144b match: drop unnecessary wrapping of regex in group
Martin von Zweigbergk <martinvonz@google.com>
parents: 38879
diff changeset
    44
      <patternmatcher patterns='a\\d'>>>
35741
73432eee0ac4 fileset: add kind:pat operator
Yuya Nishihara <yuya@tcha.org>
parents: 35704
diff changeset
    45
  b1
73432eee0ac4 fileset: add kind:pat operator
Yuya Nishihara <yuya@tcha.org>
parents: 35704
diff changeset
    46
  b2
73432eee0ac4 fileset: add kind:pat operator
Yuya Nishihara <yuya@tcha.org>
parents: 35704
diff changeset
    47
  $ fileset -v 'path:a1 or glob:b?'
73432eee0ac4 fileset: add kind:pat operator
Yuya Nishihara <yuya@tcha.org>
parents: 35704
diff changeset
    48
  (or
73432eee0ac4 fileset: add kind:pat operator
Yuya Nishihara <yuya@tcha.org>
parents: 35704
diff changeset
    49
    (kindpat
73432eee0ac4 fileset: add kind:pat operator
Yuya Nishihara <yuya@tcha.org>
parents: 35704
diff changeset
    50
      (symbol 'path')
73432eee0ac4 fileset: add kind:pat operator
Yuya Nishihara <yuya@tcha.org>
parents: 35704
diff changeset
    51
      (symbol 'a1'))
73432eee0ac4 fileset: add kind:pat operator
Yuya Nishihara <yuya@tcha.org>
parents: 35704
diff changeset
    52
    (kindpat
73432eee0ac4 fileset: add kind:pat operator
Yuya Nishihara <yuya@tcha.org>
parents: 35704
diff changeset
    53
      (symbol 'glob')
73432eee0ac4 fileset: add kind:pat operator
Yuya Nishihara <yuya@tcha.org>
parents: 35704
diff changeset
    54
      (symbol 'b?')))
38802
f0a574dbfae9 debugfileset: add option to show matcher representation
Yuya Nishihara <yuya@tcha.org>
parents: 38801
diff changeset
    55
  * matcher:
50337
47686726545d match: sort patterns before compiling them into a regex
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45895
diff changeset
    56
  <patternmatcher patterns='b.$|a1(?:/|$)'>
35741
73432eee0ac4 fileset: add kind:pat operator
Yuya Nishihara <yuya@tcha.org>
parents: 35704
diff changeset
    57
  a1
73432eee0ac4 fileset: add kind:pat operator
Yuya Nishihara <yuya@tcha.org>
parents: 35704
diff changeset
    58
  b1
73432eee0ac4 fileset: add kind:pat operator
Yuya Nishihara <yuya@tcha.org>
parents: 35704
diff changeset
    59
  b2
38802
f0a574dbfae9 debugfileset: add option to show matcher representation
Yuya Nishihara <yuya@tcha.org>
parents: 38801
diff changeset
    60
  $ fileset -v --no-show-matcher 'a1 or a2'
25255
ad1d2c952889 fileset: pretty print syntax tree in debug output
Yuya Nishihara <yuya@tcha.org>
parents: 24430
diff changeset
    61
  (or
34073
7bbc4e113e5f parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents: 31853
diff changeset
    62
    (symbol 'a1')
7bbc4e113e5f parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents: 31853
diff changeset
    63
    (symbol 'a2'))
17362
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    64
  a1
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    65
  a2
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    66
  $ fileset 'a1 | a2'
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    67
  a1
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    68
  a2
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    69
  $ fileset 'a* and "*1"'
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    70
  a1
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    71
  $ fileset 'a* & "*1"'
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    72
  a1
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    73
  $ fileset 'not (r"a*")'
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    74
  b1
17364
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
    75
  b2
17362
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    76
  $ fileset '! ("a*")'
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    77
  b1
17364
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
    78
  b2
17363
5d9e2031c0b1 fileset: actually implement 'minusset'
Patrick Mezard <patrick@mezard.eu>
parents: 17362
diff changeset
    79
  $ fileset 'a* - a1'
5d9e2031c0b1 fileset: actually implement 'minusset'
Patrick Mezard <patrick@mezard.eu>
parents: 17362
diff changeset
    80
  a2
19470
19ac0d8ee9a2 fileset: handle underbar in symbols
Matt Mackall <mpm@selenic.com>
parents: 18842
diff changeset
    81
  $ fileset 'a_b'
26233
d3dbb65c8dc6 fileset: handle error of string unescaping
Yuya Nishihara <yuya@tcha.org>
parents: 25925
diff changeset
    82
  $ fileset '"\xy"'
38327
62376d7b8859 py3: glob out some error messages in test-fileset.t
Yuya Nishihara <yuya@tcha.org>
parents: 38326
diff changeset
    83
  hg: parse error: invalid \x escape* (glob)
45895
fc4fb2f17dd4 errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents: 43439
diff changeset
    84
  [10]
17362
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    85
35691
735f47b41521 fileset: make it robust for bad function calls
Yuya Nishihara <yuya@tcha.org>
parents: 34073
diff changeset
    86
Test invalid syntax
735f47b41521 fileset: make it robust for bad function calls
Yuya Nishihara <yuya@tcha.org>
parents: 34073
diff changeset
    87
735f47b41521 fileset: make it robust for bad function calls
Yuya Nishihara <yuya@tcha.org>
parents: 34073
diff changeset
    88
  $ fileset -v '"added"()'
735f47b41521 fileset: make it robust for bad function calls
Yuya Nishihara <yuya@tcha.org>
parents: 34073
diff changeset
    89
  (func
735f47b41521 fileset: make it robust for bad function calls
Yuya Nishihara <yuya@tcha.org>
parents: 34073
diff changeset
    90
    (string 'added')
735f47b41521 fileset: make it robust for bad function calls
Yuya Nishihara <yuya@tcha.org>
parents: 34073
diff changeset
    91
    None)
735f47b41521 fileset: make it robust for bad function calls
Yuya Nishihara <yuya@tcha.org>
parents: 34073
diff changeset
    92
  hg: parse error: not a symbol
45895
fc4fb2f17dd4 errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents: 43439
diff changeset
    93
  [10]
35691
735f47b41521 fileset: make it robust for bad function calls
Yuya Nishihara <yuya@tcha.org>
parents: 34073
diff changeset
    94
  $ fileset -v '()()'
735f47b41521 fileset: make it robust for bad function calls
Yuya Nishihara <yuya@tcha.org>
parents: 34073
diff changeset
    95
  (func
735f47b41521 fileset: make it robust for bad function calls
Yuya Nishihara <yuya@tcha.org>
parents: 34073
diff changeset
    96
    (group
735f47b41521 fileset: make it robust for bad function calls
Yuya Nishihara <yuya@tcha.org>
parents: 34073
diff changeset
    97
      None)
735f47b41521 fileset: make it robust for bad function calls
Yuya Nishihara <yuya@tcha.org>
parents: 34073
diff changeset
    98
    None)
735f47b41521 fileset: make it robust for bad function calls
Yuya Nishihara <yuya@tcha.org>
parents: 34073
diff changeset
    99
  hg: parse error: not a symbol
45895
fc4fb2f17dd4 errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents: 43439
diff changeset
   100
  [10]
35692
a62b08f6626b fileset: do not crash by unary negate operation
Yuya Nishihara <yuya@tcha.org>
parents: 35691
diff changeset
   101
  $ fileset -v -- '-x'
a62b08f6626b fileset: do not crash by unary negate operation
Yuya Nishihara <yuya@tcha.org>
parents: 35691
diff changeset
   102
  (negate
a62b08f6626b fileset: do not crash by unary negate operation
Yuya Nishihara <yuya@tcha.org>
parents: 35691
diff changeset
   103
    (symbol 'x'))
a62b08f6626b fileset: do not crash by unary negate operation
Yuya Nishihara <yuya@tcha.org>
parents: 35691
diff changeset
   104
  hg: parse error: can't use negate operator in this context
45895
fc4fb2f17dd4 errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents: 43439
diff changeset
   105
  [10]
35692
a62b08f6626b fileset: do not crash by unary negate operation
Yuya Nishihara <yuya@tcha.org>
parents: 35691
diff changeset
   106
  $ fileset -v -- '-()'
a62b08f6626b fileset: do not crash by unary negate operation
Yuya Nishihara <yuya@tcha.org>
parents: 35691
diff changeset
   107
  (negate
a62b08f6626b fileset: do not crash by unary negate operation
Yuya Nishihara <yuya@tcha.org>
parents: 35691
diff changeset
   108
    (group
a62b08f6626b fileset: do not crash by unary negate operation
Yuya Nishihara <yuya@tcha.org>
parents: 35691
diff changeset
   109
      None))
a62b08f6626b fileset: do not crash by unary negate operation
Yuya Nishihara <yuya@tcha.org>
parents: 35691
diff changeset
   110
  hg: parse error: can't use negate operator in this context
45895
fc4fb2f17dd4 errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents: 43439
diff changeset
   111
  [10]
38803
4dc498d61d86 fileset: flatten arguments list
Yuya Nishihara <yuya@tcha.org>
parents: 38802
diff changeset
   112
  $ fileset -p parsed 'a, b, c'
4dc498d61d86 fileset: flatten arguments list
Yuya Nishihara <yuya@tcha.org>
parents: 38802
diff changeset
   113
  * parsed:
4dc498d61d86 fileset: flatten arguments list
Yuya Nishihara <yuya@tcha.org>
parents: 38802
diff changeset
   114
  (list
4dc498d61d86 fileset: flatten arguments list
Yuya Nishihara <yuya@tcha.org>
parents: 38802
diff changeset
   115
    (symbol 'a')
4dc498d61d86 fileset: flatten arguments list
Yuya Nishihara <yuya@tcha.org>
parents: 38802
diff changeset
   116
    (symbol 'b')
4dc498d61d86 fileset: flatten arguments list
Yuya Nishihara <yuya@tcha.org>
parents: 38802
diff changeset
   117
    (symbol 'c'))
4dc498d61d86 fileset: flatten arguments list
Yuya Nishihara <yuya@tcha.org>
parents: 38802
diff changeset
   118
  hg: parse error: can't use a list in this context
38810
4fe8d1f077b8 help: add quotes to a few commands we point to
Martin von Zweigbergk <martinvonz@google.com>
parents: 38804
diff changeset
   119
  (see 'hg help "filesets.x or y"')
45895
fc4fb2f17dd4 errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents: 43439
diff changeset
   120
  [10]
35691
735f47b41521 fileset: make it robust for bad function calls
Yuya Nishihara <yuya@tcha.org>
parents: 34073
diff changeset
   121
35741
73432eee0ac4 fileset: add kind:pat operator
Yuya Nishihara <yuya@tcha.org>
parents: 35704
diff changeset
   122
  $ fileset '"path":.'
73432eee0ac4 fileset: add kind:pat operator
Yuya Nishihara <yuya@tcha.org>
parents: 35704
diff changeset
   123
  hg: parse error: not a symbol
45895
fc4fb2f17dd4 errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents: 43439
diff changeset
   124
  [10]
35741
73432eee0ac4 fileset: add kind:pat operator
Yuya Nishihara <yuya@tcha.org>
parents: 35704
diff changeset
   125
  $ fileset 'path:foo bar'
73432eee0ac4 fileset: add kind:pat operator
Yuya Nishihara <yuya@tcha.org>
parents: 35704
diff changeset
   126
  hg: parse error at 9: invalid token
45895
fc4fb2f17dd4 errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents: 43439
diff changeset
   127
  [10]
35741
73432eee0ac4 fileset: add kind:pat operator
Yuya Nishihara <yuya@tcha.org>
parents: 35704
diff changeset
   128
  $ fileset 'foo:bar:baz'
73432eee0ac4 fileset: add kind:pat operator
Yuya Nishihara <yuya@tcha.org>
parents: 35704
diff changeset
   129
  hg: parse error: not a symbol
45895
fc4fb2f17dd4 errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents: 43439
diff changeset
   130
  [10]
35741
73432eee0ac4 fileset: add kind:pat operator
Yuya Nishihara <yuya@tcha.org>
parents: 35704
diff changeset
   131
  $ fileset 'foo:bar()'
73432eee0ac4 fileset: add kind:pat operator
Yuya Nishihara <yuya@tcha.org>
parents: 35704
diff changeset
   132
  hg: parse error: pattern must be a string
45895
fc4fb2f17dd4 errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents: 43439
diff changeset
   133
  [10]
35741
73432eee0ac4 fileset: add kind:pat operator
Yuya Nishihara <yuya@tcha.org>
parents: 35704
diff changeset
   134
  $ fileset 'foo:bar'
73432eee0ac4 fileset: add kind:pat operator
Yuya Nishihara <yuya@tcha.org>
parents: 35704
diff changeset
   135
  hg: parse error: invalid pattern kind: foo
45895
fc4fb2f17dd4 errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents: 43439
diff changeset
   136
  [10]
35741
73432eee0ac4 fileset: add kind:pat operator
Yuya Nishihara <yuya@tcha.org>
parents: 35704
diff changeset
   137
38801
1d1c1645d7b9 debugfileset: backport --show-stage option from debugrevspec
Yuya Nishihara <yuya@tcha.org>
parents: 38749
diff changeset
   138
Show parsed tree at stages:
1d1c1645d7b9 debugfileset: backport --show-stage option from debugrevspec
Yuya Nishihara <yuya@tcha.org>
parents: 38749
diff changeset
   139
1d1c1645d7b9 debugfileset: backport --show-stage option from debugrevspec
Yuya Nishihara <yuya@tcha.org>
parents: 38749
diff changeset
   140
  $ fileset -p unknown a
1d1c1645d7b9 debugfileset: backport --show-stage option from debugrevspec
Yuya Nishihara <yuya@tcha.org>
parents: 38749
diff changeset
   141
  abort: invalid stage name: unknown
1d1c1645d7b9 debugfileset: backport --show-stage option from debugrevspec
Yuya Nishihara <yuya@tcha.org>
parents: 38749
diff changeset
   142
  [255]
1d1c1645d7b9 debugfileset: backport --show-stage option from debugrevspec
Yuya Nishihara <yuya@tcha.org>
parents: 38749
diff changeset
   143
1d1c1645d7b9 debugfileset: backport --show-stage option from debugrevspec
Yuya Nishihara <yuya@tcha.org>
parents: 38749
diff changeset
   144
  $ fileset -p parsed 'path:a1 or glob:b?'
1d1c1645d7b9 debugfileset: backport --show-stage option from debugrevspec
Yuya Nishihara <yuya@tcha.org>
parents: 38749
diff changeset
   145
  * parsed:
1d1c1645d7b9 debugfileset: backport --show-stage option from debugrevspec
Yuya Nishihara <yuya@tcha.org>
parents: 38749
diff changeset
   146
  (or
1d1c1645d7b9 debugfileset: backport --show-stage option from debugrevspec
Yuya Nishihara <yuya@tcha.org>
parents: 38749
diff changeset
   147
    (kindpat
1d1c1645d7b9 debugfileset: backport --show-stage option from debugrevspec
Yuya Nishihara <yuya@tcha.org>
parents: 38749
diff changeset
   148
      (symbol 'path')
1d1c1645d7b9 debugfileset: backport --show-stage option from debugrevspec
Yuya Nishihara <yuya@tcha.org>
parents: 38749
diff changeset
   149
      (symbol 'a1'))
1d1c1645d7b9 debugfileset: backport --show-stage option from debugrevspec
Yuya Nishihara <yuya@tcha.org>
parents: 38749
diff changeset
   150
    (kindpat
1d1c1645d7b9 debugfileset: backport --show-stage option from debugrevspec
Yuya Nishihara <yuya@tcha.org>
parents: 38749
diff changeset
   151
      (symbol 'glob')
1d1c1645d7b9 debugfileset: backport --show-stage option from debugrevspec
Yuya Nishihara <yuya@tcha.org>
parents: 38749
diff changeset
   152
      (symbol 'b?')))
1d1c1645d7b9 debugfileset: backport --show-stage option from debugrevspec
Yuya Nishihara <yuya@tcha.org>
parents: 38749
diff changeset
   153
  a1
1d1c1645d7b9 debugfileset: backport --show-stage option from debugrevspec
Yuya Nishihara <yuya@tcha.org>
parents: 38749
diff changeset
   154
  b1
1d1c1645d7b9 debugfileset: backport --show-stage option from debugrevspec
Yuya Nishihara <yuya@tcha.org>
parents: 38749
diff changeset
   155
  b2
1d1c1645d7b9 debugfileset: backport --show-stage option from debugrevspec
Yuya Nishihara <yuya@tcha.org>
parents: 38749
diff changeset
   156
38802
f0a574dbfae9 debugfileset: add option to show matcher representation
Yuya Nishihara <yuya@tcha.org>
parents: 38801
diff changeset
   157
  $ fileset -p all -s 'a1 or a2 or (grep("b") & clean())'
38801
1d1c1645d7b9 debugfileset: backport --show-stage option from debugrevspec
Yuya Nishihara <yuya@tcha.org>
parents: 38749
diff changeset
   158
  * parsed:
1d1c1645d7b9 debugfileset: backport --show-stage option from debugrevspec
Yuya Nishihara <yuya@tcha.org>
parents: 38749
diff changeset
   159
  (or
38804
d82c4d42b615 fileset: flatten 'or' nodes to unnest unionmatchers
Yuya Nishihara <yuya@tcha.org>
parents: 38803
diff changeset
   160
    (symbol 'a1')
d82c4d42b615 fileset: flatten 'or' nodes to unnest unionmatchers
Yuya Nishihara <yuya@tcha.org>
parents: 38803
diff changeset
   161
    (symbol 'a2')
38801
1d1c1645d7b9 debugfileset: backport --show-stage option from debugrevspec
Yuya Nishihara <yuya@tcha.org>
parents: 38749
diff changeset
   162
    (group
1d1c1645d7b9 debugfileset: backport --show-stage option from debugrevspec
Yuya Nishihara <yuya@tcha.org>
parents: 38749
diff changeset
   163
      (and
1d1c1645d7b9 debugfileset: backport --show-stage option from debugrevspec
Yuya Nishihara <yuya@tcha.org>
parents: 38749
diff changeset
   164
        (func
1d1c1645d7b9 debugfileset: backport --show-stage option from debugrevspec
Yuya Nishihara <yuya@tcha.org>
parents: 38749
diff changeset
   165
          (symbol 'grep')
1d1c1645d7b9 debugfileset: backport --show-stage option from debugrevspec
Yuya Nishihara <yuya@tcha.org>
parents: 38749
diff changeset
   166
          (string 'b'))
1d1c1645d7b9 debugfileset: backport --show-stage option from debugrevspec
Yuya Nishihara <yuya@tcha.org>
parents: 38749
diff changeset
   167
        (func
1d1c1645d7b9 debugfileset: backport --show-stage option from debugrevspec
Yuya Nishihara <yuya@tcha.org>
parents: 38749
diff changeset
   168
          (symbol 'clean')
1d1c1645d7b9 debugfileset: backport --show-stage option from debugrevspec
Yuya Nishihara <yuya@tcha.org>
parents: 38749
diff changeset
   169
          None))))
38826
6371ab78c3b3 fileset: add phase to transform parsed tree
Yuya Nishihara <yuya@tcha.org>
parents: 38810
diff changeset
   170
  * analyzed:
6371ab78c3b3 fileset: add phase to transform parsed tree
Yuya Nishihara <yuya@tcha.org>
parents: 38810
diff changeset
   171
  (or
6371ab78c3b3 fileset: add phase to transform parsed tree
Yuya Nishihara <yuya@tcha.org>
parents: 38810
diff changeset
   172
    (symbol 'a1')
6371ab78c3b3 fileset: add phase to transform parsed tree
Yuya Nishihara <yuya@tcha.org>
parents: 38810
diff changeset
   173
    (symbol 'a2')
38827
48fc2a8af345 fileset: drop 'group' node from tree to be evaluated
Yuya Nishihara <yuya@tcha.org>
parents: 38826
diff changeset
   174
    (and
48fc2a8af345 fileset: drop 'group' node from tree to be evaluated
Yuya Nishihara <yuya@tcha.org>
parents: 38826
diff changeset
   175
      (func
48fc2a8af345 fileset: drop 'group' node from tree to be evaluated
Yuya Nishihara <yuya@tcha.org>
parents: 38826
diff changeset
   176
        (symbol 'grep')
48fc2a8af345 fileset: drop 'group' node from tree to be evaluated
Yuya Nishihara <yuya@tcha.org>
parents: 38826
diff changeset
   177
        (string 'b'))
38879
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   178
      (withstatus
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   179
        (func
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   180
          (symbol 'clean')
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   181
          None)
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   182
        (string 'clean'))))
38829
7e7e2b2ff284 fileset: add stub for weight-based optimization
Yuya Nishihara <yuya@tcha.org>
parents: 38827
diff changeset
   183
  * optimized:
7e7e2b2ff284 fileset: add stub for weight-based optimization
Yuya Nishihara <yuya@tcha.org>
parents: 38827
diff changeset
   184
  (or
38865
899b4c74209c fileset: combine union of basic patterns into single matcher
Yuya Nishihara <yuya@tcha.org>
parents: 38864
diff changeset
   185
    (patterns
899b4c74209c fileset: combine union of basic patterns into single matcher
Yuya Nishihara <yuya@tcha.org>
parents: 38864
diff changeset
   186
      (symbol 'a1')
899b4c74209c fileset: combine union of basic patterns into single matcher
Yuya Nishihara <yuya@tcha.org>
parents: 38864
diff changeset
   187
      (symbol 'a2'))
38829
7e7e2b2ff284 fileset: add stub for weight-based optimization
Yuya Nishihara <yuya@tcha.org>
parents: 38827
diff changeset
   188
    (and
38879
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   189
      (withstatus
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   190
        (func
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   191
          (symbol 'clean')
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   192
          None)
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   193
        (string 'clean'))
38829
7e7e2b2ff284 fileset: add stub for weight-based optimization
Yuya Nishihara <yuya@tcha.org>
parents: 38827
diff changeset
   194
      (func
38831
b975c5801487 fileset: reorder 'and' expression to evaluate basic patterns first
Yuya Nishihara <yuya@tcha.org>
parents: 38829
diff changeset
   195
        (symbol 'grep')
b975c5801487 fileset: reorder 'and' expression to evaluate basic patterns first
Yuya Nishihara <yuya@tcha.org>
parents: 38829
diff changeset
   196
        (string 'b'))))
38802
f0a574dbfae9 debugfileset: add option to show matcher representation
Yuya Nishihara <yuya@tcha.org>
parents: 38801
diff changeset
   197
  * matcher:
f0a574dbfae9 debugfileset: add option to show matcher representation
Yuya Nishihara <yuya@tcha.org>
parents: 38801
diff changeset
   198
  <unionmatcher matchers=[
40782
3984409e144b match: drop unnecessary wrapping of regex in group
Martin von Zweigbergk <martinvonz@google.com>
parents: 38879
diff changeset
   199
    <patternmatcher patterns='a1$|a2$'>,
38802
f0a574dbfae9 debugfileset: add option to show matcher representation
Yuya Nishihara <yuya@tcha.org>
parents: 38801
diff changeset
   200
    <intersectionmatcher
38831
b975c5801487 fileset: reorder 'and' expression to evaluate basic patterns first
Yuya Nishihara <yuya@tcha.org>
parents: 38829
diff changeset
   201
      m1=<predicatenmatcher pred=clean>,
b975c5801487 fileset: reorder 'and' expression to evaluate basic patterns first
Yuya Nishihara <yuya@tcha.org>
parents: 38829
diff changeset
   202
      m2=<predicatenmatcher pred=grep('b')>>]>
38801
1d1c1645d7b9 debugfileset: backport --show-stage option from debugrevspec
Yuya Nishihara <yuya@tcha.org>
parents: 38749
diff changeset
   203
  a1
1d1c1645d7b9 debugfileset: backport --show-stage option from debugrevspec
Yuya Nishihara <yuya@tcha.org>
parents: 38749
diff changeset
   204
  a2
1d1c1645d7b9 debugfileset: backport --show-stage option from debugrevspec
Yuya Nishihara <yuya@tcha.org>
parents: 38749
diff changeset
   205
  b1
1d1c1645d7b9 debugfileset: backport --show-stage option from debugrevspec
Yuya Nishihara <yuya@tcha.org>
parents: 38749
diff changeset
   206
  b2
1d1c1645d7b9 debugfileset: backport --show-stage option from debugrevspec
Yuya Nishihara <yuya@tcha.org>
parents: 38749
diff changeset
   207
38865
899b4c74209c fileset: combine union of basic patterns into single matcher
Yuya Nishihara <yuya@tcha.org>
parents: 38864
diff changeset
   208
Union of basic patterns:
899b4c74209c fileset: combine union of basic patterns into single matcher
Yuya Nishihara <yuya@tcha.org>
parents: 38864
diff changeset
   209
899b4c74209c fileset: combine union of basic patterns into single matcher
Yuya Nishihara <yuya@tcha.org>
parents: 38864
diff changeset
   210
  $ fileset -p optimized -s -r. 'a1 or a2 or path:b1'
899b4c74209c fileset: combine union of basic patterns into single matcher
Yuya Nishihara <yuya@tcha.org>
parents: 38864
diff changeset
   211
  * optimized:
899b4c74209c fileset: combine union of basic patterns into single matcher
Yuya Nishihara <yuya@tcha.org>
parents: 38864
diff changeset
   212
  (patterns
899b4c74209c fileset: combine union of basic patterns into single matcher
Yuya Nishihara <yuya@tcha.org>
parents: 38864
diff changeset
   213
    (symbol 'a1')
899b4c74209c fileset: combine union of basic patterns into single matcher
Yuya Nishihara <yuya@tcha.org>
parents: 38864
diff changeset
   214
    (symbol 'a2')
899b4c74209c fileset: combine union of basic patterns into single matcher
Yuya Nishihara <yuya@tcha.org>
parents: 38864
diff changeset
   215
    (kindpat
899b4c74209c fileset: combine union of basic patterns into single matcher
Yuya Nishihara <yuya@tcha.org>
parents: 38864
diff changeset
   216
      (symbol 'path')
899b4c74209c fileset: combine union of basic patterns into single matcher
Yuya Nishihara <yuya@tcha.org>
parents: 38864
diff changeset
   217
      (symbol 'b1')))
899b4c74209c fileset: combine union of basic patterns into single matcher
Yuya Nishihara <yuya@tcha.org>
parents: 38864
diff changeset
   218
  * matcher:
40782
3984409e144b match: drop unnecessary wrapping of regex in group
Martin von Zweigbergk <martinvonz@google.com>
parents: 38879
diff changeset
   219
  <patternmatcher patterns='a1$|a2$|b1(?:/|$)'>
38865
899b4c74209c fileset: combine union of basic patterns into single matcher
Yuya Nishihara <yuya@tcha.org>
parents: 38864
diff changeset
   220
  a1
899b4c74209c fileset: combine union of basic patterns into single matcher
Yuya Nishihara <yuya@tcha.org>
parents: 38864
diff changeset
   221
  a2
899b4c74209c fileset: combine union of basic patterns into single matcher
Yuya Nishihara <yuya@tcha.org>
parents: 38864
diff changeset
   222
  b1
899b4c74209c fileset: combine union of basic patterns into single matcher
Yuya Nishihara <yuya@tcha.org>
parents: 38864
diff changeset
   223
38864
73731fa8d1bd fileset: reorder 'or' expression by weight
Yuya Nishihara <yuya@tcha.org>
parents: 38832
diff changeset
   224
OR expression should be reordered by weight:
73731fa8d1bd fileset: reorder 'or' expression by weight
Yuya Nishihara <yuya@tcha.org>
parents: 38832
diff changeset
   225
73731fa8d1bd fileset: reorder 'or' expression by weight
Yuya Nishihara <yuya@tcha.org>
parents: 38832
diff changeset
   226
  $ fileset -p optimized -s -r. 'grep("a") or a1 or grep("b") or b2'
73731fa8d1bd fileset: reorder 'or' expression by weight
Yuya Nishihara <yuya@tcha.org>
parents: 38832
diff changeset
   227
  * optimized:
73731fa8d1bd fileset: reorder 'or' expression by weight
Yuya Nishihara <yuya@tcha.org>
parents: 38832
diff changeset
   228
  (or
38865
899b4c74209c fileset: combine union of basic patterns into single matcher
Yuya Nishihara <yuya@tcha.org>
parents: 38864
diff changeset
   229
    (patterns
899b4c74209c fileset: combine union of basic patterns into single matcher
Yuya Nishihara <yuya@tcha.org>
parents: 38864
diff changeset
   230
      (symbol 'a1')
899b4c74209c fileset: combine union of basic patterns into single matcher
Yuya Nishihara <yuya@tcha.org>
parents: 38864
diff changeset
   231
      (symbol 'b2'))
38864
73731fa8d1bd fileset: reorder 'or' expression by weight
Yuya Nishihara <yuya@tcha.org>
parents: 38832
diff changeset
   232
    (func
73731fa8d1bd fileset: reorder 'or' expression by weight
Yuya Nishihara <yuya@tcha.org>
parents: 38832
diff changeset
   233
      (symbol 'grep')
73731fa8d1bd fileset: reorder 'or' expression by weight
Yuya Nishihara <yuya@tcha.org>
parents: 38832
diff changeset
   234
      (string 'a'))
73731fa8d1bd fileset: reorder 'or' expression by weight
Yuya Nishihara <yuya@tcha.org>
parents: 38832
diff changeset
   235
    (func
73731fa8d1bd fileset: reorder 'or' expression by weight
Yuya Nishihara <yuya@tcha.org>
parents: 38832
diff changeset
   236
      (symbol 'grep')
73731fa8d1bd fileset: reorder 'or' expression by weight
Yuya Nishihara <yuya@tcha.org>
parents: 38832
diff changeset
   237
      (string 'b')))
73731fa8d1bd fileset: reorder 'or' expression by weight
Yuya Nishihara <yuya@tcha.org>
parents: 38832
diff changeset
   238
  * matcher:
73731fa8d1bd fileset: reorder 'or' expression by weight
Yuya Nishihara <yuya@tcha.org>
parents: 38832
diff changeset
   239
  <unionmatcher matchers=[
40782
3984409e144b match: drop unnecessary wrapping of regex in group
Martin von Zweigbergk <martinvonz@google.com>
parents: 38879
diff changeset
   240
    <patternmatcher patterns='a1$|b2$'>,
38864
73731fa8d1bd fileset: reorder 'or' expression by weight
Yuya Nishihara <yuya@tcha.org>
parents: 38832
diff changeset
   241
    <predicatenmatcher pred=grep('a')>,
73731fa8d1bd fileset: reorder 'or' expression by weight
Yuya Nishihara <yuya@tcha.org>
parents: 38832
diff changeset
   242
    <predicatenmatcher pred=grep('b')>]>
73731fa8d1bd fileset: reorder 'or' expression by weight
Yuya Nishihara <yuya@tcha.org>
parents: 38832
diff changeset
   243
  a1
73731fa8d1bd fileset: reorder 'or' expression by weight
Yuya Nishihara <yuya@tcha.org>
parents: 38832
diff changeset
   244
  a2
73731fa8d1bd fileset: reorder 'or' expression by weight
Yuya Nishihara <yuya@tcha.org>
parents: 38832
diff changeset
   245
  b1
73731fa8d1bd fileset: reorder 'or' expression by weight
Yuya Nishihara <yuya@tcha.org>
parents: 38832
diff changeset
   246
  b2
73731fa8d1bd fileset: reorder 'or' expression by weight
Yuya Nishihara <yuya@tcha.org>
parents: 38832
diff changeset
   247
38832
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   248
Use differencematcher for 'x and not y':
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   249
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   250
  $ fileset -p optimized -s 'a* and not a1'
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   251
  * optimized:
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   252
  (minus
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   253
    (symbol 'a*')
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   254
    (symbol 'a1'))
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   255
  * matcher:
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   256
  <differencematcher
40782
3984409e144b match: drop unnecessary wrapping of regex in group
Martin von Zweigbergk <martinvonz@google.com>
parents: 38879
diff changeset
   257
    m1=<patternmatcher patterns='a[^/]*$'>,
3984409e144b match: drop unnecessary wrapping of regex in group
Martin von Zweigbergk <martinvonz@google.com>
parents: 38879
diff changeset
   258
    m2=<patternmatcher patterns='a1$'>>
38832
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   259
  a2
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   260
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   261
  $ fileset -p optimized -s '!binary() and a*'
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   262
  * optimized:
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   263
  (minus
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   264
    (symbol 'a*')
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   265
    (func
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   266
      (symbol 'binary')
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   267
      None))
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   268
  * matcher:
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   269
  <differencematcher
40782
3984409e144b match: drop unnecessary wrapping of regex in group
Martin von Zweigbergk <martinvonz@google.com>
parents: 38879
diff changeset
   270
    m1=<patternmatcher patterns='a[^/]*$'>,
38832
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   271
    m2=<predicatenmatcher pred=binary>>
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   272
  a1
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   273
  a2
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   274
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   275
'x - y' is rewritten to 'x and not y' first so the operands can be reordered:
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   276
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   277
  $ fileset -p analyzed -p optimized -s 'a* - a1'
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   278
  * analyzed:
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   279
  (and
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   280
    (symbol 'a*')
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   281
    (not
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   282
      (symbol 'a1')))
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   283
  * optimized:
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   284
  (minus
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   285
    (symbol 'a*')
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   286
    (symbol 'a1'))
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   287
  * matcher:
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   288
  <differencematcher
40782
3984409e144b match: drop unnecessary wrapping of regex in group
Martin von Zweigbergk <martinvonz@google.com>
parents: 38879
diff changeset
   289
    m1=<patternmatcher patterns='a[^/]*$'>,
3984409e144b match: drop unnecessary wrapping of regex in group
Martin von Zweigbergk <martinvonz@google.com>
parents: 38879
diff changeset
   290
    m2=<patternmatcher patterns='a1$'>>
38832
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   291
  a2
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   292
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   293
  $ fileset -p analyzed -p optimized -s 'binary() - a*'
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   294
  * analyzed:
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   295
  (and
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   296
    (func
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   297
      (symbol 'binary')
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   298
      None)
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   299
    (not
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   300
      (symbol 'a*')))
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   301
  * optimized:
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   302
  (and
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   303
    (not
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   304
      (symbol 'a*'))
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   305
    (func
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   306
      (symbol 'binary')
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   307
      None))
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   308
  * matcher:
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   309
  <intersectionmatcher
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   310
    m1=<predicatenmatcher
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   311
      pred=<not
40782
3984409e144b match: drop unnecessary wrapping of regex in group
Martin von Zweigbergk <martinvonz@google.com>
parents: 38879
diff changeset
   312
        <patternmatcher patterns='a[^/]*$'>>>,
38832
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   313
    m2=<predicatenmatcher pred=binary>>
ca4de8ba5b5f fileset: optimize 'x and not y' to 'x - y'
Yuya Nishihara <yuya@tcha.org>
parents: 38831
diff changeset
   314
17364
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
   315
Test files status
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
   316
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
   317
  $ rm a1
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
   318
  $ hg rm a2
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
   319
  $ echo b >> b2
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
   320
  $ hg cp b1 c1
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
   321
  $ echo c > c2
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
   322
  $ echo c > c3
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
   323
  $ cat > .hgignore <<EOF
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
   324
  > \.hgignore
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
   325
  > 2$
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
   326
  > EOF
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
   327
  $ fileset 'modified()'
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
   328
  b2
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
   329
  $ fileset 'added()'
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
   330
  c1
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
   331
  $ fileset 'removed()'
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
   332
  a2
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
   333
  $ fileset 'deleted()'
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
   334
  a1
27024
ceef5fb14872 fileset: add missing() predicate (issue4925)
liscju <piotr.listkiewicz@gmail.com>
parents: 26953
diff changeset
   335
  $ fileset 'missing()'
ceef5fb14872 fileset: add missing() predicate (issue4925)
liscju <piotr.listkiewicz@gmail.com>
parents: 26953
diff changeset
   336
  a1
17364
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
   337
  $ fileset 'unknown()'
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
   338
  c3
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
   339
  $ fileset 'ignored()'
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
   340
  .hgignore
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
   341
  c2
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
   342
  $ fileset 'hgignore()'
38689
ff5b6fca1082 fileset: rewrite predicates to return matcher not closed to subset (API) (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 38686
diff changeset
   343
  .hgignore
17364
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
   344
  a2
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
   345
  b2
38689
ff5b6fca1082 fileset: rewrite predicates to return matcher not closed to subset (API) (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 38686
diff changeset
   346
  c2
17364
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
   347
  $ fileset 'clean()'
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
   348
  b1
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
   349
  $ fileset 'copied()'
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
   350
  c1
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
   351
31193
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   352
Test files status in different revisions
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   353
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   354
  $ hg status -m
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   355
  M b2
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   356
  $ fileset -r0 'revs("wdir()", modified())' --traceback
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   357
  b2
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   358
  $ hg status -a
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   359
  A c1
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   360
  $ fileset -r0 'revs("wdir()", added())'
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   361
  c1
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   362
  $ hg status --change 0 -a
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   363
  A a1
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   364
  A a2
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   365
  A b1
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   366
  A b2
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   367
  $ hg status -mru
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   368
  M b2
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   369
  R a2
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   370
  ? c3
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   371
  $ fileset -r0 'added() and revs("wdir()", modified() or removed() or unknown())'
38599
f9805627af1f fileset: sort debugfileset output
Yuya Nishihara <yuya@tcha.org>
parents: 38327
diff changeset
   372
  a2
31193
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   373
  b2
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   374
  $ fileset -r0 'added() or revs("wdir()", added())'
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   375
  a1
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   376
  a2
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   377
  b1
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   378
  b2
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   379
  c1
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   380
38879
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   381
Test insertion of status hints
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   382
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   383
  $ fileset -p optimized 'added()'
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   384
  * optimized:
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   385
  (withstatus
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   386
    (func
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   387
      (symbol 'added')
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   388
      None)
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   389
    (string 'added'))
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   390
  c1
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   391
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   392
  $ fileset -p optimized 'a* & removed()'
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   393
  * optimized:
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   394
  (and
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   395
    (symbol 'a*')
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   396
    (withstatus
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   397
      (func
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   398
        (symbol 'removed')
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   399
        None)
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   400
      (string 'removed')))
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   401
  a2
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   402
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   403
  $ fileset -p optimized 'a* - removed()'
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   404
  * optimized:
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   405
  (minus
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   406
    (symbol 'a*')
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   407
    (withstatus
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   408
      (func
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   409
        (symbol 'removed')
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   410
        None)
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   411
      (string 'removed')))
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   412
  a1
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   413
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   414
  $ fileset -p analyzed -p optimized '(added() + removed()) - a*'
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   415
  * analyzed:
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   416
  (and
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   417
    (withstatus
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   418
      (or
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   419
        (func
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   420
          (symbol 'added')
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   421
          None)
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   422
        (func
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   423
          (symbol 'removed')
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   424
          None))
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   425
      (string 'added removed'))
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   426
    (not
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   427
      (symbol 'a*')))
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   428
  * optimized:
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   429
  (and
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   430
    (not
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   431
      (symbol 'a*'))
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   432
    (withstatus
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   433
      (or
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   434
        (func
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   435
          (symbol 'added')
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   436
          None)
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   437
        (func
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   438
          (symbol 'removed')
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   439
          None))
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   440
      (string 'added removed')))
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   441
  c1
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   442
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   443
  $ fileset -p optimized 'a* + b* + added() + unknown()'
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   444
  * optimized:
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   445
  (withstatus
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   446
    (or
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   447
      (patterns
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   448
        (symbol 'a*')
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   449
        (symbol 'b*'))
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   450
      (func
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   451
        (symbol 'added')
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   452
        None)
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   453
      (func
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   454
        (symbol 'unknown')
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   455
        None))
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   456
    (string 'added unknown'))
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   457
  a1
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   458
  a2
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   459
  b1
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   460
  b2
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   461
  c1
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   462
  c3
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   463
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   464
  $ fileset -p analyzed -p optimized 'removed() & missing() & a*'
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   465
  * analyzed:
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   466
  (and
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   467
    (withstatus
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   468
      (and
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   469
        (func
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   470
          (symbol 'removed')
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   471
          None)
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   472
        (func
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   473
          (symbol 'missing')
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   474
          None))
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   475
      (string 'removed missing'))
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   476
    (symbol 'a*'))
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   477
  * optimized:
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   478
  (and
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   479
    (symbol 'a*')
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   480
    (withstatus
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   481
      (and
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   482
        (func
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   483
          (symbol 'removed')
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   484
          None)
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   485
        (func
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   486
          (symbol 'missing')
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   487
          None))
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   488
      (string 'removed missing')))
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   489
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   490
  $ fileset -p optimized 'clean() & revs(0, added())'
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   491
  * optimized:
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   492
  (and
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   493
    (withstatus
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   494
      (func
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   495
        (symbol 'clean')
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   496
        None)
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   497
      (string 'clean'))
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   498
    (func
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   499
      (symbol 'revs')
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   500
      (list
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   501
        (symbol '0')
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   502
        (withstatus
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   503
          (func
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   504
            (symbol 'added')
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   505
            None)
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   506
          (string 'added')))))
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   507
  b1
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   508
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   509
  $ fileset -p optimized 'clean() & status(null, 0, b* & added())'
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   510
  * optimized:
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   511
  (and
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   512
    (withstatus
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   513
      (func
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   514
        (symbol 'clean')
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   515
        None)
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   516
      (string 'clean'))
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   517
    (func
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   518
      (symbol 'status')
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   519
      (list
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   520
        (symbol 'null')
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   521
        (symbol '0')
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   522
        (and
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   523
          (symbol 'b*')
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   524
          (withstatus
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   525
            (func
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   526
              (symbol 'added')
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   527
              None)
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   528
            (string 'added'))))))
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   529
  b1
e79a69af1593 fileset: insert hints where status should be computed
Yuya Nishihara <yuya@tcha.org>
parents: 38865
diff changeset
   530
17365
8a0513bf030a fileset: exclude deleted files from matchctx.existing()
Patrick Mezard <patrick@mezard.eu>
parents: 17364
diff changeset
   531
Test files properties
8a0513bf030a fileset: exclude deleted files from matchctx.existing()
Patrick Mezard <patrick@mezard.eu>
parents: 17364
diff changeset
   532
38080
0a10f142299d py3: suppress the output from .write() calls in few tests
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36685
diff changeset
   533
  >>> open('bin', 'wb').write(b'\0a') and None
17365
8a0513bf030a fileset: exclude deleted files from matchctx.existing()
Patrick Mezard <patrick@mezard.eu>
parents: 17364
diff changeset
   534
  $ fileset 'binary()'
38689
ff5b6fca1082 fileset: rewrite predicates to return matcher not closed to subset (API) (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 38686
diff changeset
   535
  bin
17366
04c65cb59467 fileset: matchctx.existing() must consider unknown files
Patrick Mezard <patrick@mezard.eu>
parents: 17365
diff changeset
   536
  $ fileset 'binary() and unknown()'
04c65cb59467 fileset: matchctx.existing() must consider unknown files
Patrick Mezard <patrick@mezard.eu>
parents: 17365
diff changeset
   537
  bin
17367
ce625185cfd9 fileset: matchctx.existing() must consider ignored files
Patrick Mezard <patrick@mezard.eu>
parents: 17366
diff changeset
   538
  $ echo '^bin$' >> .hgignore
ce625185cfd9 fileset: matchctx.existing() must consider ignored files
Patrick Mezard <patrick@mezard.eu>
parents: 17366
diff changeset
   539
  $ fileset 'binary() and ignored()'
ce625185cfd9 fileset: matchctx.existing() must consider ignored files
Patrick Mezard <patrick@mezard.eu>
parents: 17366
diff changeset
   540
  bin
17366
04c65cb59467 fileset: matchctx.existing() must consider unknown files
Patrick Mezard <patrick@mezard.eu>
parents: 17365
diff changeset
   541
  $ hg add bin
04c65cb59467 fileset: matchctx.existing() must consider unknown files
Patrick Mezard <patrick@mezard.eu>
parents: 17365
diff changeset
   542
  $ fileset 'binary()'
04c65cb59467 fileset: matchctx.existing() must consider unknown files
Patrick Mezard <patrick@mezard.eu>
parents: 17365
diff changeset
   543
  bin
17365
8a0513bf030a fileset: exclude deleted files from matchctx.existing()
Patrick Mezard <patrick@mezard.eu>
parents: 17364
diff changeset
   544
38831
b975c5801487 fileset: reorder 'and' expression to evaluate basic patterns first
Yuya Nishihara <yuya@tcha.org>
parents: 38829
diff changeset
   545
  $ fileset -p optimized -s 'binary() and b*'
b975c5801487 fileset: reorder 'and' expression to evaluate basic patterns first
Yuya Nishihara <yuya@tcha.org>
parents: 38829
diff changeset
   546
  * optimized:
b975c5801487 fileset: reorder 'and' expression to evaluate basic patterns first
Yuya Nishihara <yuya@tcha.org>
parents: 38829
diff changeset
   547
  (and
b975c5801487 fileset: reorder 'and' expression to evaluate basic patterns first
Yuya Nishihara <yuya@tcha.org>
parents: 38829
diff changeset
   548
    (symbol 'b*')
b975c5801487 fileset: reorder 'and' expression to evaluate basic patterns first
Yuya Nishihara <yuya@tcha.org>
parents: 38829
diff changeset
   549
    (func
b975c5801487 fileset: reorder 'and' expression to evaluate basic patterns first
Yuya Nishihara <yuya@tcha.org>
parents: 38829
diff changeset
   550
      (symbol 'binary')
b975c5801487 fileset: reorder 'and' expression to evaluate basic patterns first
Yuya Nishihara <yuya@tcha.org>
parents: 38829
diff changeset
   551
      None))
b975c5801487 fileset: reorder 'and' expression to evaluate basic patterns first
Yuya Nishihara <yuya@tcha.org>
parents: 38829
diff changeset
   552
  * matcher:
b975c5801487 fileset: reorder 'and' expression to evaluate basic patterns first
Yuya Nishihara <yuya@tcha.org>
parents: 38829
diff changeset
   553
  <intersectionmatcher
40782
3984409e144b match: drop unnecessary wrapping of regex in group
Martin von Zweigbergk <martinvonz@google.com>
parents: 38879
diff changeset
   554
    m1=<patternmatcher patterns='b[^/]*$'>,
38831
b975c5801487 fileset: reorder 'and' expression to evaluate basic patterns first
Yuya Nishihara <yuya@tcha.org>
parents: 38829
diff changeset
   555
    m2=<predicatenmatcher pred=binary>>
b975c5801487 fileset: reorder 'and' expression to evaluate basic patterns first
Yuya Nishihara <yuya@tcha.org>
parents: 38829
diff changeset
   556
  bin
b975c5801487 fileset: reorder 'and' expression to evaluate basic patterns first
Yuya Nishihara <yuya@tcha.org>
parents: 38829
diff changeset
   557
17368
01cc267fc105 fileset: do not traceback on invalid grep pattern
Patrick Mezard <patrick@mezard.eu>
parents: 17367
diff changeset
   558
  $ fileset 'grep("b{1}")'
38689
ff5b6fca1082 fileset: rewrite predicates to return matcher not closed to subset (API) (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 38686
diff changeset
   559
  .hgignore
38599
f9805627af1f fileset: sort debugfileset output
Yuya Nishihara <yuya@tcha.org>
parents: 38327
diff changeset
   560
  b1
17368
01cc267fc105 fileset: do not traceback on invalid grep pattern
Patrick Mezard <patrick@mezard.eu>
parents: 17367
diff changeset
   561
  b2
01cc267fc105 fileset: do not traceback on invalid grep pattern
Patrick Mezard <patrick@mezard.eu>
parents: 17367
diff changeset
   562
  c1
01cc267fc105 fileset: do not traceback on invalid grep pattern
Patrick Mezard <patrick@mezard.eu>
parents: 17367
diff changeset
   563
  $ fileset 'grep("missingparens(")'
38327
62376d7b8859 py3: glob out some error messages in test-fileset.t
Yuya Nishihara <yuya@tcha.org>
parents: 38326
diff changeset
   564
  hg: parse error: invalid match pattern: (unbalanced parenthesis|missing \)).* (re)
45895
fc4fb2f17dd4 errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents: 43439
diff changeset
   565
  [10]
17368
01cc267fc105 fileset: do not traceback on invalid grep pattern
Patrick Mezard <patrick@mezard.eu>
parents: 17367
diff changeset
   566
17369
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   567
#if execbit
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   568
  $ chmod +x b2
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   569
  $ fileset 'exec()'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   570
  b2
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   571
#endif
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   572
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   573
#if symlink
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   574
  $ ln -s b2 b2link
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   575
  $ fileset 'symlink() and unknown()'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   576
  b2link
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   577
  $ hg add b2link
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   578
#endif
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   579
24408
caa6b6c65dc3 fileset: add a fileset for portable filenames
Siddharth Agarwal <sid0@fb.com>
parents: 21947
diff changeset
   580
#if no-windows
caa6b6c65dc3 fileset: add a fileset for portable filenames
Siddharth Agarwal <sid0@fb.com>
parents: 21947
diff changeset
   581
  $ echo foo > con.xml
24430
98d9d33dfd95 test-fileset.t: remove 'bar ' and 'baz\' from tested filenames
Siddharth Agarwal <sid0@fb.com>
parents: 24424
diff changeset
   582
  $ fileset 'not portable()'
24408
caa6b6c65dc3 fileset: add a fileset for portable filenames
Siddharth Agarwal <sid0@fb.com>
parents: 21947
diff changeset
   583
  con.xml
24430
98d9d33dfd95 test-fileset.t: remove 'bar ' and 'baz\' from tested filenames
Siddharth Agarwal <sid0@fb.com>
parents: 24424
diff changeset
   584
  $ hg --config ui.portablefilenames=ignore add con.xml
24408
caa6b6c65dc3 fileset: add a fileset for portable filenames
Siddharth Agarwal <sid0@fb.com>
parents: 21947
diff changeset
   585
#endif
caa6b6c65dc3 fileset: add a fileset for portable filenames
Siddharth Agarwal <sid0@fb.com>
parents: 21947
diff changeset
   586
38080
0a10f142299d py3: suppress the output from .write() calls in few tests
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36685
diff changeset
   587
  >>> open('1k', 'wb').write(b' '*1024) and None
0a10f142299d py3: suppress the output from .write() calls in few tests
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36685
diff changeset
   588
  >>> open('2k', 'wb').write(b' '*2048) and None
17369
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   589
  $ hg add 1k 2k
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   590
  $ fileset 'size("bar")'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   591
  hg: parse error: couldn't parse size: bar
45895
fc4fb2f17dd4 errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents: 43439
diff changeset
   592
  [10]
27518
737ffdabbde9 fileset: add hint for list error to use or
timeless <timeless@mozdev.org>
parents: 27477
diff changeset
   593
  $ fileset '(1k, 2k)'
737ffdabbde9 fileset: add hint for list error to use or
timeless <timeless@mozdev.org>
parents: 27477
diff changeset
   594
  hg: parse error: can't use a list in this context
38810
4fe8d1f077b8 help: add quotes to a few commands we point to
Martin von Zweigbergk <martinvonz@google.com>
parents: 38804
diff changeset
   595
  (see 'hg help "filesets.x or y"')
45895
fc4fb2f17dd4 errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents: 43439
diff changeset
   596
  [10]
17369
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   597
  $ fileset 'size(1k)'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   598
  1k
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   599
  $ fileset '(1k or 2k) and size("< 2k")'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   600
  1k
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   601
  $ fileset '(1k or 2k) and size("<=2k")'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   602
  1k
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   603
  2k
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   604
  $ fileset '(1k or 2k) and size("> 1k")'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   605
  2k
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   606
  $ fileset '(1k or 2k) and size(">=1K")'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   607
  1k
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   608
  2k
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   609
  $ fileset '(1k or 2k) and size(".5KB - 1.5kB")'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   610
  1k
25925
23c4589fc678 filesets: ignore unit case in size() predicate for single value
Anton Shestakov <av6@dwimlabs.net>
parents: 25587
diff changeset
   611
  $ fileset 'size("1M")'
23c4589fc678 filesets: ignore unit case in size() predicate for single value
Anton Shestakov <av6@dwimlabs.net>
parents: 25587
diff changeset
   612
  $ fileset 'size("1 GB")'
17369
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   613
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   614
Test merge states
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   615
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   616
  $ hg ci -m manychanges
35950
7b2b82f891bf fileset: don't abort when running copied() on a revision with a removed file
Matt Harbison <matt_harbison@yahoo.com>
parents: 35741
diff changeset
   617
  $ hg file -r . 'set:copied() & modified()'
7b2b82f891bf fileset: don't abort when running copied() on a revision with a removed file
Matt Harbison <matt_harbison@yahoo.com>
parents: 35741
diff changeset
   618
  [1]
17369
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   619
  $ hg up -C 0
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   620
  * files updated, 0 files merged, * files removed, 0 files unresolved (glob)
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   621
  $ echo c >> b2
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   622
  $ hg ci -m diverging b2
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   623
  created new head
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   624
  $ fileset 'resolved()'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   625
  $ fileset 'unresolved()'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   626
  $ hg merge
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   627
  merging b2
26614
ef1eb6df7071 simplemerge: move conflict warning message to filemerge
Siddharth Agarwal <sid0@fb.com>
parents: 26233
diff changeset
   628
  warning: conflicts while merging b2! (edit, then use 'hg resolve --mark')
26953
2da6a2dbfc42 test-fileset: glob the updated file count for Windows stability
Matt Harbison <matt_harbison@yahoo.com>
parents: 26614
diff changeset
   629
  * files updated, 0 files merged, 1 files removed, 1 files unresolved (glob)
35704
41ef02ba329b merge: add `--abort` flag which can abort the merge
Pulkit Goyal <7895pulkit@gmail.com>
parents: 35692
diff changeset
   630
  use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
17369
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   631
  [1]
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   632
  $ fileset 'resolved()'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   633
  $ fileset 'unresolved()'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   634
  b2
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   635
  $ echo e > b2
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   636
  $ hg resolve -m b2
21947
b081decd9062 resolve: add parenthesis around "no more unresolved files" message
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21267
diff changeset
   637
  (no more unresolved files)
17369
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   638
  $ fileset 'resolved()'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   639
  b2
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   640
  $ fileset 'unresolved()'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   641
  $ hg ci -m merge
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   642
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   643
Test subrepo predicate
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   644
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   645
  $ hg init sub
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   646
  $ echo a > sub/suba
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   647
  $ hg -R sub add sub/suba
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   648
  $ hg -R sub ci -m sub
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   649
  $ echo 'sub = sub' > .hgsub
25558
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
   650
  $ hg init sub2
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
   651
  $ echo b > sub2/b
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
   652
  $ hg -R sub2 ci -Am sub2
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
   653
  adding b
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
   654
  $ echo 'sub2 = sub2' >> .hgsub
17369
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   655
  $ fileset 'subrepo()'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   656
  $ hg add .hgsub
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   657
  $ fileset 'subrepo()'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   658
  sub
25558
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
   659
  sub2
17369
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   660
  $ fileset 'subrepo("sub")'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   661
  sub
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   662
  $ fileset 'subrepo("glob:*")'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   663
  sub
25558
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
   664
  sub2
17370
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   665
  $ hg ci -m subrepo
17369
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   666
25558
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
   667
Test that .hgsubstate is updated as appropriate during a conversion.  The
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
   668
saverev property is enough to alter the hashes of the subrepo.
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
   669
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
   670
  $ hg init ../converted
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
   671
  $ hg --config extensions.convert= convert --config convert.hg.saverev=True  \
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
   672
  >      sub ../converted/sub
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
   673
  initializing destination ../converted/sub repository
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
   674
  scanning source...
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
   675
  sorting...
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
   676
  converting...
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
   677
  0 sub
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
   678
  $ hg clone -U sub2 ../converted/sub2
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
   679
  $ hg --config extensions.convert= convert --config convert.hg.saverev=True  \
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
   680
  >      . ../converted
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
   681
  scanning source...
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
   682
  sorting...
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
   683
  converting...
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
   684
  4 addfiles
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
   685
  3 manychanges
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
   686
  2 diverging
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
   687
  1 merge
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
   688
  0 subrepo
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
   689
  no ".hgsubstate" updates will be made for "sub2"
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
   690
  $ hg up -q -R ../converted -r tip
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
   691
  $ hg --cwd ../converted cat sub/suba sub2/b -r tip
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
   692
  a
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
   693
  b
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
   694
  $ oldnode=`hg log -r tip -T "{node}\n"`
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
   695
  $ newnode=`hg log -R ../converted -r tip -T "{node}\n"`
25587
49fb24f72747 test-fileset: remove bashism, use test instead of '[[ ]]'
Yuya Nishihara <yuya@tcha.org>
parents: 25558
diff changeset
   696
  $ [ "$oldnode" != "$newnode" ] || echo "nothing changed"
25558
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
   697
17370
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   698
Test with a revision
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   699
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   700
  $ hg log -G --template '{rev} {desc}\n'
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   701
  @  4 subrepo
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   702
  |
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   703
  o    3 merge
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   704
  |\
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   705
  | o  2 diverging
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   706
  | |
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   707
  o |  1 manychanges
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   708
  |/
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   709
  o  0 addfiles
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   710
  
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   711
  $ echo unknown > unknown
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   712
  $ fileset -r1 'modified()'
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   713
  b2
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   714
  $ fileset -r1 'added() and c1'
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   715
  c1
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   716
  $ fileset -r1 'removed()'
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   717
  a2
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   718
  $ fileset -r1 'deleted()'
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   719
  $ fileset -r1 'unknown()'
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   720
  $ fileset -r1 'ignored()'
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   721
  $ fileset -r1 'hgignore()'
38689
ff5b6fca1082 fileset: rewrite predicates to return matcher not closed to subset (API) (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 38686
diff changeset
   722
  .hgignore
ff5b6fca1082 fileset: rewrite predicates to return matcher not closed to subset (API) (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 38686
diff changeset
   723
  a2
17370
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   724
  b2
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   725
  bin
38689
ff5b6fca1082 fileset: rewrite predicates to return matcher not closed to subset (API) (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 38686
diff changeset
   726
  c2
ff5b6fca1082 fileset: rewrite predicates to return matcher not closed to subset (API) (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 38686
diff changeset
   727
  sub2
17370
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   728
  $ fileset -r1 'binary()'
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   729
  bin
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   730
  $ fileset -r1 'size(1k)'
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   731
  1k
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   732
  $ fileset -r3 'resolved()'
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   733
  $ fileset -r3 'unresolved()'
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   734
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   735
#if execbit
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   736
  $ fileset -r1 'exec()'
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   737
  b2
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   738
#endif
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   739
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   740
#if symlink
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   741
  $ fileset -r1 'symlink()'
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   742
  b2link
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   743
#endif
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   744
24408
caa6b6c65dc3 fileset: add a fileset for portable filenames
Siddharth Agarwal <sid0@fb.com>
parents: 21947
diff changeset
   745
#if no-windows
caa6b6c65dc3 fileset: add a fileset for portable filenames
Siddharth Agarwal <sid0@fb.com>
parents: 21947
diff changeset
   746
  $ fileset -r1 'not portable()'
caa6b6c65dc3 fileset: add a fileset for portable filenames
Siddharth Agarwal <sid0@fb.com>
parents: 21947
diff changeset
   747
  con.xml
24424
f7a3ea7b9dc6 test-fileset: forget non-portable files to avoid failures on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 24408
diff changeset
   748
  $ hg forget 'con.xml'
24408
caa6b6c65dc3 fileset: add a fileset for portable filenames
Siddharth Agarwal <sid0@fb.com>
parents: 21947
diff changeset
   749
#endif
caa6b6c65dc3 fileset: add a fileset for portable filenames
Siddharth Agarwal <sid0@fb.com>
parents: 21947
diff changeset
   750
17370
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   751
  $ fileset -r4 'subrepo("re:su.*")'
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   752
  sub
25558
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
   753
  sub2
35741
73432eee0ac4 fileset: add kind:pat operator
Yuya Nishihara <yuya@tcha.org>
parents: 35704
diff changeset
   754
  $ fileset -r4 'subrepo(re:su.*)'
73432eee0ac4 fileset: add kind:pat operator
Yuya Nishihara <yuya@tcha.org>
parents: 35704
diff changeset
   755
  sub
73432eee0ac4 fileset: add kind:pat operator
Yuya Nishihara <yuya@tcha.org>
parents: 35704
diff changeset
   756
  sub2
17370
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   757
  $ fileset -r4 'subrepo("sub")'
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   758
  sub
17371
1310489eb5d6 fileset: fix generator vs list bug in fast path
Patrick Mezard <patrick@mezard.eu>
parents: 17370
diff changeset
   759
  $ fileset -r4 'b2 or c1'
1310489eb5d6 fileset: fix generator vs list bug in fast path
Patrick Mezard <patrick@mezard.eu>
parents: 17370
diff changeset
   760
  b2
1310489eb5d6 fileset: fix generator vs list bug in fast path
Patrick Mezard <patrick@mezard.eu>
parents: 17370
diff changeset
   761
  c1
17370
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   762
38080
0a10f142299d py3: suppress the output from .write() calls in few tests
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36685
diff changeset
   763
  >>> open('dos', 'wb').write(b"dos\r\n") and None
0a10f142299d py3: suppress the output from .write() calls in few tests
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36685
diff changeset
   764
  >>> open('mixed', 'wb').write(b"dos\r\nunix\n") and None
0a10f142299d py3: suppress the output from .write() calls in few tests
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36685
diff changeset
   765
  >>> open('mac', 'wb').write(b"mac\r") and None
18842
3ce3f2b059a1 filesets: add eol predicate
Matt Mackall <mpm@selenic.com>
parents: 17371
diff changeset
   766
  $ hg add dos mixed mac
3ce3f2b059a1 filesets: add eol predicate
Matt Mackall <mpm@selenic.com>
parents: 17371
diff changeset
   767
27459
2f15253e415f fileset: treat encoding and eol as the predicate calling _existing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27024
diff changeset
   768
(remove a1, to examine safety of 'eol' on removed files)
2f15253e415f fileset: treat encoding and eol as the predicate calling _existing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27024
diff changeset
   769
  $ rm a1
2f15253e415f fileset: treat encoding and eol as the predicate calling _existing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27024
diff changeset
   770
18842
3ce3f2b059a1 filesets: add eol predicate
Matt Mackall <mpm@selenic.com>
parents: 17371
diff changeset
   771
  $ fileset 'eol(dos)'
3ce3f2b059a1 filesets: add eol predicate
Matt Mackall <mpm@selenic.com>
parents: 17371
diff changeset
   772
  dos
3ce3f2b059a1 filesets: add eol predicate
Matt Mackall <mpm@selenic.com>
parents: 17371
diff changeset
   773
  mixed
3ce3f2b059a1 filesets: add eol predicate
Matt Mackall <mpm@selenic.com>
parents: 17371
diff changeset
   774
  $ fileset 'eol(unix)'
38689
ff5b6fca1082 fileset: rewrite predicates to return matcher not closed to subset (API) (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 38686
diff changeset
   775
  .hgignore
18842
3ce3f2b059a1 filesets: add eol predicate
Matt Mackall <mpm@selenic.com>
parents: 17371
diff changeset
   776
  .hgsub
3ce3f2b059a1 filesets: add eol predicate
Matt Mackall <mpm@selenic.com>
parents: 17371
diff changeset
   777
  .hgsubstate
3ce3f2b059a1 filesets: add eol predicate
Matt Mackall <mpm@selenic.com>
parents: 17371
diff changeset
   778
  b1
3ce3f2b059a1 filesets: add eol predicate
Matt Mackall <mpm@selenic.com>
parents: 17371
diff changeset
   779
  b2
38689
ff5b6fca1082 fileset: rewrite predicates to return matcher not closed to subset (API) (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 38686
diff changeset
   780
  b2.orig
18842
3ce3f2b059a1 filesets: add eol predicate
Matt Mackall <mpm@selenic.com>
parents: 17371
diff changeset
   781
  c1
38689
ff5b6fca1082 fileset: rewrite predicates to return matcher not closed to subset (API) (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 38686
diff changeset
   782
  c2
ff5b6fca1082 fileset: rewrite predicates to return matcher not closed to subset (API) (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 38686
diff changeset
   783
  c3
38749
0c5d131fa428 test-fileset: make con.xml in output conditionally available
Yuya Nishihara <yuya@tcha.org>
parents: 38690
diff changeset
   784
  con.xml (no-windows !)
38599
f9805627af1f fileset: sort debugfileset output
Yuya Nishihara <yuya@tcha.org>
parents: 38327
diff changeset
   785
  mixed
38689
ff5b6fca1082 fileset: rewrite predicates to return matcher not closed to subset (API) (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 38686
diff changeset
   786
  unknown
18842
3ce3f2b059a1 filesets: add eol predicate
Matt Mackall <mpm@selenic.com>
parents: 17371
diff changeset
   787
  $ fileset 'eol(mac)'
3ce3f2b059a1 filesets: add eol predicate
Matt Mackall <mpm@selenic.com>
parents: 17371
diff changeset
   788
  mac
27459
2f15253e415f fileset: treat encoding and eol as the predicate calling _existing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27024
diff changeset
   789
2f15253e415f fileset: treat encoding and eol as the predicate calling _existing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27024
diff changeset
   790
Test safety of 'encoding' on removed files
2f15253e415f fileset: treat encoding and eol as the predicate calling _existing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27024
diff changeset
   791
2f15253e415f fileset: treat encoding and eol as the predicate calling _existing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27024
diff changeset
   792
  $ fileset 'encoding("ascii")'
38689
ff5b6fca1082 fileset: rewrite predicates to return matcher not closed to subset (API) (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 38686
diff changeset
   793
  .hgignore
27459
2f15253e415f fileset: treat encoding and eol as the predicate calling _existing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27024
diff changeset
   794
  .hgsub
2f15253e415f fileset: treat encoding and eol as the predicate calling _existing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27024
diff changeset
   795
  .hgsubstate
2f15253e415f fileset: treat encoding and eol as the predicate calling _existing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27024
diff changeset
   796
  1k
2f15253e415f fileset: treat encoding and eol as the predicate calling _existing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27024
diff changeset
   797
  2k
2f15253e415f fileset: treat encoding and eol as the predicate calling _existing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27024
diff changeset
   798
  b1
2f15253e415f fileset: treat encoding and eol as the predicate calling _existing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27024
diff changeset
   799
  b2
38689
ff5b6fca1082 fileset: rewrite predicates to return matcher not closed to subset (API) (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 38686
diff changeset
   800
  b2.orig
31853
67ea8e857489 test-fileset: eliminate a duplicate test that was conditionalized for output
Matt Harbison <matt_harbison@yahoo.com>
parents: 31852
diff changeset
   801
  b2link (symlink !)
27459
2f15253e415f fileset: treat encoding and eol as the predicate calling _existing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27024
diff changeset
   802
  bin
2f15253e415f fileset: treat encoding and eol as the predicate calling _existing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27024
diff changeset
   803
  c1
38689
ff5b6fca1082 fileset: rewrite predicates to return matcher not closed to subset (API) (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 38686
diff changeset
   804
  c2
ff5b6fca1082 fileset: rewrite predicates to return matcher not closed to subset (API) (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 38686
diff changeset
   805
  c3
38749
0c5d131fa428 test-fileset: make con.xml in output conditionally available
Yuya Nishihara <yuya@tcha.org>
parents: 38690
diff changeset
   806
  con.xml (no-windows !)
38599
f9805627af1f fileset: sort debugfileset output
Yuya Nishihara <yuya@tcha.org>
parents: 38327
diff changeset
   807
  dos
f9805627af1f fileset: sort debugfileset output
Yuya Nishihara <yuya@tcha.org>
parents: 38327
diff changeset
   808
  mac
f9805627af1f fileset: sort debugfileset output
Yuya Nishihara <yuya@tcha.org>
parents: 38327
diff changeset
   809
  mixed
38689
ff5b6fca1082 fileset: rewrite predicates to return matcher not closed to subset (API) (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 38686
diff changeset
   810
  unknown
27464
c39ecb2b86b3 fileset: detect unintentional existing() invocation at runtime
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27459
diff changeset
   811
31193
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   812
Test 'revs(...)'
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   813
================
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   814
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   815
small reminder of the repository state
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   816
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   817
  $ hg log -G
31852
7ef0816bfe64 test-fileset: glob away hash differences
Matt Harbison <matt_harbison@yahoo.com>
parents: 31830
diff changeset
   818
  @  changeset:   4:* (glob)
31193
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   819
  |  tag:         tip
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   820
  |  user:        test
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   821
  |  date:        Thu Jan 01 00:00:00 1970 +0000
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   822
  |  summary:     subrepo
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   823
  |
31852
7ef0816bfe64 test-fileset: glob away hash differences
Matt Harbison <matt_harbison@yahoo.com>
parents: 31830
diff changeset
   824
  o    changeset:   3:* (glob)
31193
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   825
  |\   parent:      2:55b05bdebf36
31852
7ef0816bfe64 test-fileset: glob away hash differences
Matt Harbison <matt_harbison@yahoo.com>
parents: 31830
diff changeset
   826
  | |  parent:      1:* (glob)
31193
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   827
  | |  user:        test
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   828
  | |  date:        Thu Jan 01 00:00:00 1970 +0000
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   829
  | |  summary:     merge
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   830
  | |
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   831
  | o  changeset:   2:55b05bdebf36
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   832
  | |  parent:      0:8a9576c51c1f
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   833
  | |  user:        test
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   834
  | |  date:        Thu Jan 01 00:00:00 1970 +0000
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   835
  | |  summary:     diverging
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   836
  | |
31852
7ef0816bfe64 test-fileset: glob away hash differences
Matt Harbison <matt_harbison@yahoo.com>
parents: 31830
diff changeset
   837
  o |  changeset:   1:* (glob)
31193
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   838
  |/   user:        test
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   839
  |    date:        Thu Jan 01 00:00:00 1970 +0000
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   840
  |    summary:     manychanges
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   841
  |
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   842
  o  changeset:   0:8a9576c51c1f
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   843
     user:        test
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   844
     date:        Thu Jan 01 00:00:00 1970 +0000
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   845
     summary:     addfiles
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   846
  
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   847
  $ hg status --change 0
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   848
  A a1
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   849
  A a2
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   850
  A b1
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   851
  A b2
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   852
  $ hg status --change 1
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   853
  M b2
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   854
  A 1k
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   855
  A 2k
43439
0a0bad6d7ac0 tests: fix a few `(no-windows !)` conditionals that are really `(symlink !)`
Matt Harbison <matt_harbison@yahoo.com>
parents: 40782
diff changeset
   856
  A b2link (symlink !)
31193
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   857
  A bin
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   858
  A c1
31830
d34316ae5c58 tests: add per-line output conditionals for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 31195
diff changeset
   859
  A con.xml (no-windows !)
31193
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   860
  R a2
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   861
  $ hg status --change 2
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   862
  M b2
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   863
  $ hg status --change 3
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   864
  M b2
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   865
  A 1k
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   866
  A 2k
43439
0a0bad6d7ac0 tests: fix a few `(no-windows !)` conditionals that are really `(symlink !)`
Matt Harbison <matt_harbison@yahoo.com>
parents: 40782
diff changeset
   867
  A b2link (symlink !)
31193
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   868
  A bin
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   869
  A c1
31830
d34316ae5c58 tests: add per-line output conditionals for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 31195
diff changeset
   870
  A con.xml (no-windows !)
31193
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   871
  R a2
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   872
  $ hg status --change 4
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   873
  A .hgsub
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   874
  A .hgsubstate
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   875
  $ hg status
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   876
  A dos
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   877
  A mac
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   878
  A mixed
31830
d34316ae5c58 tests: add per-line output conditionals for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 31195
diff changeset
   879
  R con.xml (no-windows !)
31193
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   880
  ! a1
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   881
  ? b2.orig
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   882
  ? c3
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   883
  ? unknown
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   884
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   885
Test files at -r0 should be filtered by files at wdir
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   886
-----------------------------------------------------
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   887
38686
131aae58a316 fileset: add "tracked()" to explicitly select files in the revision
Yuya Nishihara <yuya@tcha.org>
parents: 38610
diff changeset
   888
  $ fileset -r0 'tracked() and revs("wdir()", tracked())'
31193
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   889
  a1
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   890
  b1
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   891
  b2
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   892
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   893
Test that "revs()" work at all
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   894
------------------------------
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   895
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   896
  $ fileset "revs('2', modified())"
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   897
  b2
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   898
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   899
Test that "revs()" work for file missing in the working copy/current context
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   900
----------------------------------------------------------------------------
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   901
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   902
(a2 not in working copy)
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   903
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   904
  $ fileset "revs('0', added())"
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   905
  a1
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   906
  a2
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   907
  b1
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   908
  b2
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   909
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   910
(none of the file exist in "0")
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   911
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   912
  $ fileset -r 0 "revs('4', added())"
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   913
  .hgsub
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   914
  .hgsubstate
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   915
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   916
Call with empty revset
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   917
--------------------------
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   918
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   919
  $ fileset "revs('2-2', modified())"
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   920
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   921
Call with revset matching multiple revs
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   922
---------------------------------------
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   923
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   924
  $ fileset "revs('0+4', added())"
38599
f9805627af1f fileset: sort debugfileset output
Yuya Nishihara <yuya@tcha.org>
parents: 38327
diff changeset
   925
  .hgsub
f9805627af1f fileset: sort debugfileset output
Yuya Nishihara <yuya@tcha.org>
parents: 38327
diff changeset
   926
  .hgsubstate
31193
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   927
  a1
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   928
  a2
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   929
  b1
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   930
  b2
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   931
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   932
overlapping set
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   933
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   934
  $ fileset "revs('1+2', modified())"
4140d49d2efb fileset: add revs(revs, fileset) to evaluate set in working directory
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28447
diff changeset
   935
  b2
31195
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   936
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   937
test 'status(...)'
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   938
=================
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   939
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   940
Simple case
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   941
-----------
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   942
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   943
  $ fileset "status(3, 4, added())"
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   944
  .hgsub
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   945
  .hgsubstate
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   946
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   947
use rev to restrict matched file
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   948
-----------------------------------------
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   949
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   950
  $ hg status --removed --rev 0 --rev 1
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   951
  R a2
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   952
  $ fileset "status(0, 1, removed())"
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   953
  a2
38686
131aae58a316 fileset: add "tracked()" to explicitly select files in the revision
Yuya Nishihara <yuya@tcha.org>
parents: 38610
diff changeset
   954
  $ fileset "tracked() and status(0, 1, removed())"
31195
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   955
  $ fileset -r 4 "status(0, 1, removed())"
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   956
  a2
38686
131aae58a316 fileset: add "tracked()" to explicitly select files in the revision
Yuya Nishihara <yuya@tcha.org>
parents: 38610
diff changeset
   957
  $ fileset -r 4 "tracked() and status(0, 1, removed())"
131aae58a316 fileset: add "tracked()" to explicitly select files in the revision
Yuya Nishihara <yuya@tcha.org>
parents: 38610
diff changeset
   958
  $ fileset "revs('4', tracked() and status(0, 1, removed()))"
131aae58a316 fileset: add "tracked()" to explicitly select files in the revision
Yuya Nishihara <yuya@tcha.org>
parents: 38610
diff changeset
   959
  $ fileset "revs('0', tracked() and status(0, 1, removed()))"
31195
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   960
  a2
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   961
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   962
check wdir()
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   963
------------
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   964
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   965
  $ hg status --removed  --rev 4
31830
d34316ae5c58 tests: add per-line output conditionals for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 31195
diff changeset
   966
  R con.xml (no-windows !)
31195
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   967
  $ fileset "status(4, 'wdir()', removed())"
31830
d34316ae5c58 tests: add per-line output conditionals for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 31195
diff changeset
   968
  con.xml (no-windows !)
31195
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   969
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   970
  $ hg status --removed --rev 2
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   971
  R a2
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   972
  $ fileset "status('2', 'wdir()', removed())"
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   973
  a2
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   974
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   975
test backward status
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   976
--------------------
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   977
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   978
  $ hg status --removed --rev 0 --rev 4
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   979
  R a2
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   980
  $ hg status --added --rev 4 --rev 0
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   981
  A a2
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   982
  $ fileset "status(4, 0, added())"
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   983
  a2
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   984
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   985
test cross branch status
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   986
------------------------
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   987
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   988
  $ hg status --added --rev 1 --rev 2
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   989
  A a2
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   990
  $ fileset "status(1, 2, added())"
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   991
  a2
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   992
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   993
test with multi revs revset
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   994
---------------------------
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   995
  $ hg status --added --rev 0:1 --rev 3:4
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   996
  A .hgsub
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   997
  A .hgsubstate
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   998
  A 1k
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
   999
  A 2k
43439
0a0bad6d7ac0 tests: fix a few `(no-windows !)` conditionals that are really `(symlink !)`
Matt Harbison <matt_harbison@yahoo.com>
parents: 40782
diff changeset
  1000
  A b2link (symlink !)
31195
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
  1001
  A bin
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
  1002
  A c1
31830
d34316ae5c58 tests: add per-line output conditionals for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 31195
diff changeset
  1003
  A con.xml (no-windows !)
31195
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
  1004
  $ fileset "status('0:1', '3:4', added())"
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
  1005
  .hgsub
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
  1006
  .hgsubstate
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
  1007
  1k
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
  1008
  2k
43439
0a0bad6d7ac0 tests: fix a few `(no-windows !)` conditionals that are really `(symlink !)`
Matt Harbison <matt_harbison@yahoo.com>
parents: 40782
diff changeset
  1009
  b2link (symlink !)
31195
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
  1010
  bin
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
  1011
  c1
31830
d34316ae5c58 tests: add per-line output conditionals for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 31195
diff changeset
  1012
  con.xml (no-windows !)
31195
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
  1013
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
  1014
tests with empty value
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
  1015
----------------------
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
  1016
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
  1017
Fully empty revset
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
  1018
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
  1019
  $ fileset "status('', '4', added())"
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
  1020
  hg: parse error: first argument to status must be a revision
45895
fc4fb2f17dd4 errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents: 43439
diff changeset
  1021
  [10]
31195
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
  1022
  $ fileset "status('2', '', added())"
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
  1023
  hg: parse error: second argument to status must be a revision
45895
fc4fb2f17dd4 errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents: 43439
diff changeset
  1024
  [10]
31195
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
  1025
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
  1026
Empty revset will error at the revset layer
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
  1027
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
  1028
  $ fileset "status(' ', '4', added())"
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
  1029
  hg: parse error at 1: not a prefix: end
36685
2a258985ffeb revsetlang: add a hint for more useful parse errors
Ryan McElroy <rmcelroy@fb.com>
parents: 36028
diff changeset
  1030
  ( 
2a258985ffeb revsetlang: add a hint for more useful parse errors
Ryan McElroy <rmcelroy@fb.com>
parents: 36028
diff changeset
  1031
    ^ here)
45895
fc4fb2f17dd4 errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents: 43439
diff changeset
  1032
  [10]
31195
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
  1033
  $ fileset "status('2', ' ', added())"
6b098ac4542e fileset: add a 'status(...)' predicate to control evaluation context
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31193
diff changeset
  1034
  hg: parse error at 1: not a prefix: end
36685
2a258985ffeb revsetlang: add a hint for more useful parse errors
Ryan McElroy <rmcelroy@fb.com>
parents: 36028
diff changeset
  1035
  ( 
2a258985ffeb revsetlang: add a hint for more useful parse errors
Ryan McElroy <rmcelroy@fb.com>
parents: 36028
diff changeset
  1036
    ^ here)
45895
fc4fb2f17dd4 errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents: 43439
diff changeset
  1037
  [10]