tests/test-fileset.t
author Patrick Mezard <patrick@mezard.eu>
Wed, 15 Aug 2012 22:29:32 +0200
branchstable
changeset 17367 ce625185cfd9
parent 17366 04c65cb59467
child 17368 01cc267fc105
permissions -rw-r--r--
fileset: matchctx.existing() must consider ignored files When running: $ hg debugfileset 'binary() and ignored()' getfileset() was correctly retrieving ignored files but matchctx.existing() was not taking them in account. Just add them along with unknown files.
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