tests/test-fileset.t
author Bryan O'Sullivan <bryano@fb.com>
Fri, 12 Apr 2013 16:01:18 -0700
changeset 18913 79580b3140cd
parent 18842 3ce3f2b059a1
child 19470 19ac0d8ee9a2
permissions -rw-r--r--
histedit: support editing of the first commit (issue3767)
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() {
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
     2
  >   hg debugfileset "$@"
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
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    19
  $ fileset a1
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    20
  a1
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    21
  $ fileset 'a*'
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    22
  a1
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    23
  a2
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    24
  $ fileset '"re:a\d"'
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    25
  a1
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    26
  a2
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    27
  $ fileset 'a1 or a2'
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
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    30
  $ fileset 'a1 | a2'
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    31
  a1
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    32
  a2
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    33
  $ fileset 'a* and "*1"'
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
  $ fileset 'a* & "*1"'
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    36
  a1
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    37
  $ fileset 'not (r"a*")'
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    38
  b1
17364
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
    39
  b2
17362
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    40
  $ fileset '! ("a*")'
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    41
  b1
17364
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
    42
  b2
17363
5d9e2031c0b1 fileset: actually implement 'minusset'
Patrick Mezard <patrick@mezard.eu>
parents: 17362
diff changeset
    43
  $ fileset 'a* - a1'
5d9e2031c0b1 fileset: actually implement 'minusset'
Patrick Mezard <patrick@mezard.eu>
parents: 17362
diff changeset
    44
  a2
17362
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    45
17364
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
    46
Test files status
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
    47
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
    48
  $ rm a1
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
    49
  $ hg rm a2
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
    50
  $ echo b >> b2
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
    51
  $ hg cp b1 c1
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
    52
  $ echo c > c2
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
    53
  $ echo c > c3
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
    54
  $ cat > .hgignore <<EOF
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
    55
  > \.hgignore
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
    56
  > 2$
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
    57
  > EOF
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
    58
  $ fileset 'modified()'
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
    59
  b2
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
    60
  $ fileset 'added()'
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
    61
  c1
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
    62
  $ fileset 'removed()'
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
    63
  a2
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
    64
  $ fileset 'deleted()'
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
    65
  a1
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
    66
  $ fileset 'unknown()'
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
    67
  c3
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
    68
  $ fileset 'ignored()'
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
    69
  .hgignore
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
    70
  c2
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
    71
  $ fileset 'hgignore()'
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
    72
  a2
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
    73
  b2
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
    74
  $ fileset 'clean()'
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
    75
  b1
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
    76
  $ fileset 'copied()'
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
    77
  c1
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
    78
17365
8a0513bf030a fileset: exclude deleted files from matchctx.existing()
Patrick Mezard <patrick@mezard.eu>
parents: 17364
diff changeset
    79
Test files properties
8a0513bf030a fileset: exclude deleted files from matchctx.existing()
Patrick Mezard <patrick@mezard.eu>
parents: 17364
diff changeset
    80
8a0513bf030a fileset: exclude deleted files from matchctx.existing()
Patrick Mezard <patrick@mezard.eu>
parents: 17364
diff changeset
    81
  >>> file('bin', 'wb').write('\0a')
8a0513bf030a fileset: exclude deleted files from matchctx.existing()
Patrick Mezard <patrick@mezard.eu>
parents: 17364
diff changeset
    82
  $ fileset 'binary()'
17366
04c65cb59467 fileset: matchctx.existing() must consider unknown files
Patrick Mezard <patrick@mezard.eu>
parents: 17365
diff changeset
    83
  $ fileset 'binary() and unknown()'
04c65cb59467 fileset: matchctx.existing() must consider unknown files
Patrick Mezard <patrick@mezard.eu>
parents: 17365
diff changeset
    84
  bin
17367
ce625185cfd9 fileset: matchctx.existing() must consider ignored files
Patrick Mezard <patrick@mezard.eu>
parents: 17366
diff changeset
    85
  $ echo '^bin$' >> .hgignore
ce625185cfd9 fileset: matchctx.existing() must consider ignored files
Patrick Mezard <patrick@mezard.eu>
parents: 17366
diff changeset
    86
  $ fileset 'binary() and ignored()'
ce625185cfd9 fileset: matchctx.existing() must consider ignored files
Patrick Mezard <patrick@mezard.eu>
parents: 17366
diff changeset
    87
  bin
17366
04c65cb59467 fileset: matchctx.existing() must consider unknown files
Patrick Mezard <patrick@mezard.eu>
parents: 17365
diff changeset
    88
  $ hg add bin
04c65cb59467 fileset: matchctx.existing() must consider unknown files
Patrick Mezard <patrick@mezard.eu>
parents: 17365
diff changeset
    89
  $ fileset 'binary()'
04c65cb59467 fileset: matchctx.existing() must consider unknown files
Patrick Mezard <patrick@mezard.eu>
parents: 17365
diff changeset
    90
  bin
17365
8a0513bf030a fileset: exclude deleted files from matchctx.existing()
Patrick Mezard <patrick@mezard.eu>
parents: 17364
diff changeset
    91
17368
01cc267fc105 fileset: do not traceback on invalid grep pattern
Patrick Mezard <patrick@mezard.eu>
parents: 17367
diff changeset
    92
  $ fileset 'grep("b{1}")'
01cc267fc105 fileset: do not traceback on invalid grep pattern
Patrick Mezard <patrick@mezard.eu>
parents: 17367
diff changeset
    93
  b2
01cc267fc105 fileset: do not traceback on invalid grep pattern
Patrick Mezard <patrick@mezard.eu>
parents: 17367
diff changeset
    94
  c1
01cc267fc105 fileset: do not traceback on invalid grep pattern
Patrick Mezard <patrick@mezard.eu>
parents: 17367
diff changeset
    95
  b1
01cc267fc105 fileset: do not traceback on invalid grep pattern
Patrick Mezard <patrick@mezard.eu>
parents: 17367
diff changeset
    96
  $ fileset 'grep("missingparens(")'
01cc267fc105 fileset: do not traceback on invalid grep pattern
Patrick Mezard <patrick@mezard.eu>
parents: 17367
diff changeset
    97
  hg: parse error: invalid match pattern: unbalanced parenthesis
01cc267fc105 fileset: do not traceback on invalid grep pattern
Patrick Mezard <patrick@mezard.eu>
parents: 17367
diff changeset
    98
  [255]
01cc267fc105 fileset: do not traceback on invalid grep pattern
Patrick Mezard <patrick@mezard.eu>
parents: 17367
diff changeset
    99
17369
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   100
#if execbit
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   101
  $ chmod +x b2
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   102
  $ fileset 'exec()'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   103
  b2
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   104
#endif
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   105
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   106
#if symlink
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   107
  $ ln -s b2 b2link
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   108
  $ fileset 'symlink() and unknown()'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   109
  b2link
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   110
  $ hg add b2link
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   111
#endif
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   112
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   113
  >>> file('1k', 'wb').write(' '*1024)
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   114
  >>> file('2k', 'wb').write(' '*2048)
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   115
  $ hg add 1k 2k
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   116
  $ fileset 'size("bar")'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   117
  hg: parse error: couldn't parse size: bar
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   118
  [255]
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   119
  $ fileset 'size(1k)'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   120
  1k
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   121
  $ fileset '(1k or 2k) and size("< 2k")'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   122
  1k
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   123
  $ fileset '(1k or 2k) and size("<=2k")'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   124
  1k
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   125
  2k
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   126
  $ fileset '(1k or 2k) and size("> 1k")'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   127
  2k
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   128
  $ fileset '(1k or 2k) and size(">=1K")'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   129
  1k
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   130
  2k
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   131
  $ fileset '(1k or 2k) and size(".5KB - 1.5kB")'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   132
  1k
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   133
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   134
Test merge states
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   135
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   136
  $ hg ci -m manychanges
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   137
  $ hg up -C 0
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   138
  * 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
   139
  $ echo c >> b2
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   140
  $ hg ci -m diverging b2
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   141
  created new head
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   142
  $ fileset 'resolved()'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   143
  $ fileset 'unresolved()'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   144
  $ hg merge
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   145
  merging b2
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   146
  warning: conflicts during merge.
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   147
  merging b2 incomplete! (edit conflicts, then use 'hg resolve --mark')
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   148
  * files updated, 0 files merged, * files removed, 1 files unresolved (glob)
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   149
  use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   150
  [1]
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   151
  $ fileset 'resolved()'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   152
  $ fileset 'unresolved()'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   153
  b2
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   154
  $ echo e > b2
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   155
  $ hg resolve -m b2
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   156
  $ fileset 'resolved()'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   157
  b2
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   158
  $ fileset 'unresolved()'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   159
  $ hg ci -m merge
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   160
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   161
Test subrepo predicate
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   162
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   163
  $ hg init sub
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   164
  $ echo a > sub/suba
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   165
  $ hg -R sub add sub/suba
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   166
  $ hg -R sub ci -m sub
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   167
  $ echo 'sub = sub' > .hgsub
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   168
  $ fileset 'subrepo()'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   169
  $ hg add .hgsub
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   170
  $ fileset 'subrepo()'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   171
  sub
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   172
  $ fileset 'subrepo("sub")'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   173
  sub
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   174
  $ fileset 'subrepo("glob:*")'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   175
  sub
17370
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   176
  $ hg ci -m subrepo
17369
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
   177
17370
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   178
Test with a revision
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   179
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   180
  $ hg log -G --template '{rev} {desc}\n'
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   181
  @  4 subrepo
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   182
  |
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   183
  o    3 merge
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   184
  |\
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   185
  | o  2 diverging
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   186
  | |
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   187
  o |  1 manychanges
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   188
  |/
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   189
  o  0 addfiles
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   190
  
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   191
  $ echo unknown > unknown
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   192
  $ fileset -r1 'modified()'
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   193
  b2
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   194
  $ fileset -r1 'added() and c1'
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   195
  c1
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   196
  $ fileset -r1 'removed()'
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   197
  a2
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   198
  $ fileset -r1 'deleted()'
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   199
  $ fileset -r1 'unknown()'
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   200
  $ fileset -r1 'ignored()'
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   201
  $ fileset -r1 'hgignore()'
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   202
  b2
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   203
  bin
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   204
  $ fileset -r1 'binary()'
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   205
  bin
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   206
  $ fileset -r1 'size(1k)'
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   207
  1k
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   208
  $ fileset -r3 'resolved()'
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   209
  $ fileset -r3 'unresolved()'
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   210
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   211
#if execbit
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   212
  $ fileset -r1 'exec()'
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   213
  b2
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   214
#endif
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   215
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   216
#if symlink
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   217
  $ fileset -r1 'symlink()'
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   218
  b2link
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   219
#endif
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   220
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   221
  $ fileset -r4 'subrepo("re:su.*")'
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   222
  sub
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   223
  $ fileset -r4 'subrepo("sub")'
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   224
  sub
17371
1310489eb5d6 fileset: fix generator vs list bug in fast path
Patrick Mezard <patrick@mezard.eu>
parents: 17370
diff changeset
   225
  $ fileset -r4 'b2 or c1'
1310489eb5d6 fileset: fix generator vs list bug in fast path
Patrick Mezard <patrick@mezard.eu>
parents: 17370
diff changeset
   226
  b2
1310489eb5d6 fileset: fix generator vs list bug in fast path
Patrick Mezard <patrick@mezard.eu>
parents: 17370
diff changeset
   227
  c1
17370
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
   228
18842
3ce3f2b059a1 filesets: add eol predicate
Matt Mackall <mpm@selenic.com>
parents: 17371
diff changeset
   229
  >>> open('dos', 'wb').write("dos\r\n")
3ce3f2b059a1 filesets: add eol predicate
Matt Mackall <mpm@selenic.com>
parents: 17371
diff changeset
   230
  >>> open('mixed', 'wb').write("dos\r\nunix\n")
3ce3f2b059a1 filesets: add eol predicate
Matt Mackall <mpm@selenic.com>
parents: 17371
diff changeset
   231
  >>> open('mac', 'wb').write("mac\r")
3ce3f2b059a1 filesets: add eol predicate
Matt Mackall <mpm@selenic.com>
parents: 17371
diff changeset
   232
  $ hg add dos mixed mac
3ce3f2b059a1 filesets: add eol predicate
Matt Mackall <mpm@selenic.com>
parents: 17371
diff changeset
   233
3ce3f2b059a1 filesets: add eol predicate
Matt Mackall <mpm@selenic.com>
parents: 17371
diff changeset
   234
  $ fileset 'eol(dos)'
3ce3f2b059a1 filesets: add eol predicate
Matt Mackall <mpm@selenic.com>
parents: 17371
diff changeset
   235
  dos
3ce3f2b059a1 filesets: add eol predicate
Matt Mackall <mpm@selenic.com>
parents: 17371
diff changeset
   236
  mixed
3ce3f2b059a1 filesets: add eol predicate
Matt Mackall <mpm@selenic.com>
parents: 17371
diff changeset
   237
  $ fileset 'eol(unix)'
3ce3f2b059a1 filesets: add eol predicate
Matt Mackall <mpm@selenic.com>
parents: 17371
diff changeset
   238
  .hgsub
3ce3f2b059a1 filesets: add eol predicate
Matt Mackall <mpm@selenic.com>
parents: 17371
diff changeset
   239
  .hgsubstate
3ce3f2b059a1 filesets: add eol predicate
Matt Mackall <mpm@selenic.com>
parents: 17371
diff changeset
   240
  a1
3ce3f2b059a1 filesets: add eol predicate
Matt Mackall <mpm@selenic.com>
parents: 17371
diff changeset
   241
  b1
3ce3f2b059a1 filesets: add eol predicate
Matt Mackall <mpm@selenic.com>
parents: 17371
diff changeset
   242
  b2
3ce3f2b059a1 filesets: add eol predicate
Matt Mackall <mpm@selenic.com>
parents: 17371
diff changeset
   243
  c1
3ce3f2b059a1 filesets: add eol predicate
Matt Mackall <mpm@selenic.com>
parents: 17371
diff changeset
   244
  mixed
3ce3f2b059a1 filesets: add eol predicate
Matt Mackall <mpm@selenic.com>
parents: 17371
diff changeset
   245
  $ fileset 'eol(mac)'
3ce3f2b059a1 filesets: add eol predicate
Matt Mackall <mpm@selenic.com>
parents: 17371
diff changeset
   246
  mac