tests/test-walk.t
changeset 38479 67dc32d4e790
parent 38276 fbb2eddea4d2
child 39723 5abc47d4ca6b
equal deleted inserted replaced
38478:96f65bdf0bf4 38479:67dc32d4e790
    90   f  mammals/Procyonidae/coatimundi  Procyonidae/coatimundi
    90   f  mammals/Procyonidae/coatimundi  Procyonidae/coatimundi
    91   f  mammals/Procyonidae/raccoon     Procyonidae/raccoon
    91   f  mammals/Procyonidae/raccoon     Procyonidae/raccoon
    92   f  mammals/skunk                   skunk
    92   f  mammals/skunk                   skunk
    93   $ hg debugwalk -v -I '*k'
    93   $ hg debugwalk -v -I '*k'
    94   * matcher:
    94   * matcher:
    95   <includematcher includes='(?:mammals\\/[^/]*k(?:/|$))'>
    95   <includematcher includes='(?:mammals/[^/]*k(?:/|$))'>
    96   f  mammals/skunk  skunk
    96   f  mammals/skunk  skunk
    97   $ hg debugwalk -v -I 'glob:*k'
    97   $ hg debugwalk -v -I 'glob:*k'
    98   * matcher:
    98   * matcher:
    99   <includematcher includes='(?:mammals\\/[^/]*k(?:/|$))'>
    99   <includematcher includes='(?:mammals/[^/]*k(?:/|$))'>
   100   f  mammals/skunk  skunk
   100   f  mammals/skunk  skunk
   101   $ hg debugwalk -v -I 'relglob:*k'
   101   $ hg debugwalk -v -I 'relglob:*k'
   102   * matcher:
   102   * matcher:
   103   <includematcher includes='(?:(?:|.*/)[^/]*k(?:/|$))'>
   103   <includematcher includes='(?:(?:|.*/)[^/]*k(?:/|$))'>
   104   f  beans/black    ../beans/black
   104   f  beans/black    ../beans/black
   258   f  mammals/Procyonidae/coatimundi  Procyonidae/coatimundi
   258   f  mammals/Procyonidae/coatimundi  Procyonidae/coatimundi
   259   f  mammals/Procyonidae/raccoon     Procyonidae/raccoon
   259   f  mammals/Procyonidae/raccoon     Procyonidae/raccoon
   260   f  mammals/skunk                   skunk
   260   f  mammals/skunk                   skunk
   261   $ hg debugwalk -v Procyonidae
   261   $ hg debugwalk -v Procyonidae
   262   * matcher:
   262   * matcher:
   263   <patternmatcher patterns='(?:mammals\\/Procyonidae(?:/|$))'>
   263   <patternmatcher patterns='(?:mammals/Procyonidae(?:/|$))'>
   264   f  mammals/Procyonidae/cacomistle  Procyonidae/cacomistle
   264   f  mammals/Procyonidae/cacomistle  Procyonidae/cacomistle
   265   f  mammals/Procyonidae/coatimundi  Procyonidae/coatimundi
   265   f  mammals/Procyonidae/coatimundi  Procyonidae/coatimundi
   266   f  mammals/Procyonidae/raccoon     Procyonidae/raccoon
   266   f  mammals/Procyonidae/raccoon     Procyonidae/raccoon
   267 
   267 
   268   $ cd Procyonidae
   268   $ cd Procyonidae
   269   $ hg debugwalk -v .
   269   $ hg debugwalk -v .
   270   * matcher:
   270   * matcher:
   271   <patternmatcher patterns='(?:mammals\\/Procyonidae(?:/|$))'>
   271   <patternmatcher patterns='(?:mammals/Procyonidae(?:/|$))'>
   272   f  mammals/Procyonidae/cacomistle  cacomistle
   272   f  mammals/Procyonidae/cacomistle  cacomistle
   273   f  mammals/Procyonidae/coatimundi  coatimundi
   273   f  mammals/Procyonidae/coatimundi  coatimundi
   274   f  mammals/Procyonidae/raccoon     raccoon
   274   f  mammals/Procyonidae/raccoon     raccoon
   275   $ hg debugwalk -v ..
   275   $ hg debugwalk -v ..
   276   * matcher:
   276   * matcher:
   314   f  beans/navy      beans/navy
   314   f  beans/navy      beans/navy
   315   f  beans/pinto     beans/pinto
   315   f  beans/pinto     beans/pinto
   316   f  beans/turtle    beans/turtle
   316   f  beans/turtle    beans/turtle
   317   $ hg debugwalk -v -I '{*,{b,m}*/*}k'
   317   $ hg debugwalk -v -I '{*,{b,m}*/*}k'
   318   * matcher:
   318   * matcher:
   319   <includematcher includes='(?:(?:[^/]*|(?:b|m)[^/]*\\/[^/]*)k(?:/|$))'>
   319   <includematcher includes='(?:(?:[^/]*|(?:b|m)[^/]*/[^/]*)k(?:/|$))'>
   320   f  beans/black    beans/black
   320   f  beans/black    beans/black
   321   f  fenugreek      fenugreek
   321   f  fenugreek      fenugreek
   322   f  mammals/skunk  mammals/skunk
   322   f  mammals/skunk  mammals/skunk
   323   $ hg debugwalk -v -Ibeans mammals
   323   $ hg debugwalk -v -Ibeans mammals
   324   * matcher:
   324   * matcher:
   328   $ hg debugwalk -v -Inon-existent
   328   $ hg debugwalk -v -Inon-existent
   329   * matcher:
   329   * matcher:
   330   <includematcher includes='(?:non\\-existent(?:/|$))'>
   330   <includematcher includes='(?:non\\-existent(?:/|$))'>
   331   $ hg debugwalk -v -Inon-existent -Ibeans/black
   331   $ hg debugwalk -v -Inon-existent -Ibeans/black
   332   * matcher:
   332   * matcher:
   333   <includematcher includes='(?:non\\-existent(?:/|$)|beans\\/black(?:/|$))'>
   333   <includematcher includes='(?:non\\-existent(?:/|$)|beans/black(?:/|$))'>
   334   f  beans/black  beans/black
   334   f  beans/black  beans/black
   335   $ hg debugwalk -v -Ibeans beans/black
   335   $ hg debugwalk -v -Ibeans beans/black
   336   * matcher:
   336   * matcher:
   337   <intersectionmatcher
   337   <intersectionmatcher
   338     m1=<patternmatcher patterns='(?:beans\\/black(?:/|$))'>,
   338     m1=<patternmatcher patterns='(?:beans/black(?:/|$))'>,
   339     m2=<includematcher includes='(?:beans(?:/|$))'>>
   339     m2=<includematcher includes='(?:beans(?:/|$))'>>
   340   f  beans/black  beans/black  exact
   340   f  beans/black  beans/black  exact
   341   $ hg debugwalk -v -Ibeans/black beans
   341   $ hg debugwalk -v -Ibeans/black beans
   342   * matcher:
   342   * matcher:
   343   <intersectionmatcher
   343   <intersectionmatcher
   344     m1=<patternmatcher patterns='(?:beans(?:/|$))'>,
   344     m1=<patternmatcher patterns='(?:beans(?:/|$))'>,
   345     m2=<includematcher includes='(?:beans\\/black(?:/|$))'>>
   345     m2=<includematcher includes='(?:beans/black(?:/|$))'>>
   346   f  beans/black  beans/black
   346   f  beans/black  beans/black
   347   $ hg debugwalk -v -Xbeans/black beans
   347   $ hg debugwalk -v -Xbeans/black beans
   348   * matcher:
   348   * matcher:
   349   <differencematcher
   349   <differencematcher
   350     m1=<patternmatcher patterns='(?:beans(?:/|$))'>,
   350     m1=<patternmatcher patterns='(?:beans(?:/|$))'>,
   351     m2=<includematcher includes='(?:beans\\/black(?:/|$))'>>
   351     m2=<includematcher includes='(?:beans/black(?:/|$))'>>
   352   f  beans/borlotti  beans/borlotti
   352   f  beans/borlotti  beans/borlotti
   353   f  beans/kidney    beans/kidney
   353   f  beans/kidney    beans/kidney
   354   f  beans/navy      beans/navy
   354   f  beans/navy      beans/navy
   355   f  beans/pinto     beans/pinto
   355   f  beans/pinto     beans/pinto
   356   f  beans/turtle    beans/turtle
   356   f  beans/turtle    beans/turtle
   357   $ hg debugwalk -v -Xbeans/black -Ibeans
   357   $ hg debugwalk -v -Xbeans/black -Ibeans
   358   * matcher:
   358   * matcher:
   359   <differencematcher
   359   <differencematcher
   360     m1=<includematcher includes='(?:beans(?:/|$))'>,
   360     m1=<includematcher includes='(?:beans(?:/|$))'>,
   361     m2=<includematcher includes='(?:beans\\/black(?:/|$))'>>
   361     m2=<includematcher includes='(?:beans/black(?:/|$))'>>
   362   f  beans/borlotti  beans/borlotti
   362   f  beans/borlotti  beans/borlotti
   363   f  beans/kidney    beans/kidney
   363   f  beans/kidney    beans/kidney
   364   f  beans/navy      beans/navy
   364   f  beans/navy      beans/navy
   365   f  beans/pinto     beans/pinto
   365   f  beans/pinto     beans/pinto
   366   f  beans/turtle    beans/turtle
   366   f  beans/turtle    beans/turtle
   367   $ hg debugwalk -v -Xbeans/black beans/black
   367   $ hg debugwalk -v -Xbeans/black beans/black
   368   * matcher:
   368   * matcher:
   369   <differencematcher
   369   <differencematcher
   370     m1=<patternmatcher patterns='(?:beans\\/black(?:/|$))'>,
   370     m1=<patternmatcher patterns='(?:beans/black(?:/|$))'>,
   371     m2=<includematcher includes='(?:beans\\/black(?:/|$))'>>
   371     m2=<includematcher includes='(?:beans/black(?:/|$))'>>
   372   $ hg debugwalk -v -Xbeans/black -Ibeans/black
   372   $ hg debugwalk -v -Xbeans/black -Ibeans/black
   373   * matcher:
   373   * matcher:
   374   <differencematcher
   374   <differencematcher
   375     m1=<includematcher includes='(?:beans\\/black(?:/|$))'>,
   375     m1=<includematcher includes='(?:beans/black(?:/|$))'>,
   376     m2=<includematcher includes='(?:beans\\/black(?:/|$))'>>
   376     m2=<includematcher includes='(?:beans/black(?:/|$))'>>
   377   $ hg debugwalk -v -Xbeans beans/black
   377   $ hg debugwalk -v -Xbeans beans/black
   378   * matcher:
   378   * matcher:
   379   <differencematcher
   379   <differencematcher
   380     m1=<patternmatcher patterns='(?:beans\\/black(?:/|$))'>,
   380     m1=<patternmatcher patterns='(?:beans/black(?:/|$))'>,
   381     m2=<includematcher includes='(?:beans(?:/|$))'>>
   381     m2=<includematcher includes='(?:beans(?:/|$))'>>
   382   $ hg debugwalk -v -Xbeans -Ibeans/black
   382   $ hg debugwalk -v -Xbeans -Ibeans/black
   383   * matcher:
   383   * matcher:
   384   <differencematcher
   384   <differencematcher
   385     m1=<includematcher includes='(?:beans\\/black(?:/|$))'>,
   385     m1=<includematcher includes='(?:beans/black(?:/|$))'>,
   386     m2=<includematcher includes='(?:beans(?:/|$))'>>
   386     m2=<includematcher includes='(?:beans(?:/|$))'>>
   387   $ hg debugwalk -v 'glob:mammals/../beans/b*'
   387   $ hg debugwalk -v 'glob:mammals/../beans/b*'
   388   * matcher:
   388   * matcher:
   389   <patternmatcher patterns='(?:beans\\/b[^/]*$)'>
   389   <patternmatcher patterns='(?:beans/b[^/]*$)'>
   390   f  beans/black     beans/black
   390   f  beans/black     beans/black
   391   f  beans/borlotti  beans/borlotti
   391   f  beans/borlotti  beans/borlotti
   392   $ hg debugwalk -v '-X*/Procyonidae' mammals
   392   $ hg debugwalk -v '-X*/Procyonidae' mammals
   393   * matcher:
   393   * matcher:
   394   <differencematcher
   394   <differencematcher
   395     m1=<patternmatcher patterns='(?:mammals(?:/|$))'>,
   395     m1=<patternmatcher patterns='(?:mammals(?:/|$))'>,
   396     m2=<includematcher includes='(?:[^/]*\\/Procyonidae(?:/|$))'>>
   396     m2=<includematcher includes='(?:[^/]*/Procyonidae(?:/|$))'>>
   397   f  mammals/skunk  mammals/skunk
   397   f  mammals/skunk  mammals/skunk
   398   $ hg debugwalk -v path:mammals
   398   $ hg debugwalk -v path:mammals
   399   * matcher:
   399   * matcher:
   400   <patternmatcher patterns='(?:mammals(?:/|$))'>
   400   <patternmatcher patterns='(?:mammals(?:/|$))'>
   401   f  mammals/Procyonidae/cacomistle  mammals/Procyonidae/cacomistle
   401   f  mammals/Procyonidae/cacomistle  mammals/Procyonidae/cacomistle
   434     m1=<patternmatcher patterns='(?:fennel(?:/|$))'>,
   434     m1=<patternmatcher patterns='(?:fennel(?:/|$))'>,
   435     m2=<includematcher includes='(?:f[^/]*(?:/|$))'>>
   435     m2=<includematcher includes='(?:f[^/]*(?:/|$))'>>
   436   $ hg debugwalk -v beans/black -X 'path:beans'
   436   $ hg debugwalk -v beans/black -X 'path:beans'
   437   * matcher:
   437   * matcher:
   438   <differencematcher
   438   <differencematcher
   439     m1=<patternmatcher patterns='(?:beans\\/black(?:/|$))'>,
   439     m1=<patternmatcher patterns='(?:beans/black(?:/|$))'>,
   440     m2=<includematcher includes='(?:beans(?:/|$))'>>
   440     m2=<includematcher includes='(?:beans(?:/|$))'>>
   441   $ hg debugwalk -v -I 'path:beans/black' -X 'path:beans'
   441   $ hg debugwalk -v -I 'path:beans/black' -X 'path:beans'
   442   * matcher:
   442   * matcher:
   443   <differencematcher
   443   <differencematcher
   444     m1=<includematcher includes='(?:beans\\/black(?:/|$))'>,
   444     m1=<includematcher includes='(?:beans/black(?:/|$))'>,
   445     m2=<includematcher includes='(?:beans(?:/|$))'>>
   445     m2=<includematcher includes='(?:beans(?:/|$))'>>
   446 
   446 
   447 Test absolute paths:
   447 Test absolute paths:
   448 
   448 
   449   $ hg debugwalk -v `pwd`/beans
   449   $ hg debugwalk -v `pwd`/beans
   483   * matcher:
   483   * matcher:
   484   <patternmatcher patterns='(?:glob$)'>
   484   <patternmatcher patterns='(?:glob$)'>
   485   glob: $ENOENT$
   485   glob: $ENOENT$
   486   $ hg debugwalk -v glob:glob:glob
   486   $ hg debugwalk -v glob:glob:glob
   487   * matcher:
   487   * matcher:
   488   <patternmatcher patterns='(?:glob\\:glob$)'>
   488   <patternmatcher patterns='(?:glob:glob$)'>
   489   f  glob:glob  glob:glob  exact
   489   f  glob:glob  glob:glob  exact
   490   $ hg debugwalk -v path:glob:glob
   490   $ hg debugwalk -v path:glob:glob
   491   * matcher:
   491   * matcher:
   492   <patternmatcher patterns='(?:glob\\:glob(?:/|$))'>
   492   <patternmatcher patterns='(?:glob:glob(?:/|$))'>
   493   f  glob:glob  glob:glob  exact
   493   f  glob:glob  glob:glob  exact
   494   $ rm glob:glob
   494   $ rm glob:glob
   495   $ hg addremove
   495   $ hg addremove
   496   removing glob:glob
   496   removing glob:glob
   497 #endif
   497 #endif
   509   f  fenugreek      fenugreek
   509   f  fenugreek      fenugreek
   510   f  mammals/skunk  mammals/skunk
   510   f  mammals/skunk  mammals/skunk
   511 
   511 
   512   $ hg debugwalk -v path:beans/black
   512   $ hg debugwalk -v path:beans/black
   513   * matcher:
   513   * matcher:
   514   <patternmatcher patterns='(?:beans\\/black(?:/|$))'>
   514   <patternmatcher patterns='(?:beans/black(?:/|$))'>
   515   f  beans/black  beans/black  exact
   515   f  beans/black  beans/black  exact
   516   $ hg debugwalk -v path:beans//black
   516   $ hg debugwalk -v path:beans//black
   517   * matcher:
   517   * matcher:
   518   <patternmatcher patterns='(?:beans\\/black(?:/|$))'>
   518   <patternmatcher patterns='(?:beans/black(?:/|$))'>
   519   f  beans/black  beans/black  exact
   519   f  beans/black  beans/black  exact
   520 
   520 
   521   $ hg debugwalk -v relglob:Procyonidae
   521   $ hg debugwalk -v relglob:Procyonidae
   522   * matcher:
   522   * matcher:
   523   <patternmatcher patterns='(?:(?:|.*/)Procyonidae$)'>
   523   <patternmatcher patterns='(?:(?:|.*/)Procyonidae$)'>
   524   $ hg debugwalk -v 'relglob:Procyonidae/**'
   524   $ hg debugwalk -v 'relglob:Procyonidae/**'
   525   * matcher:
   525   * matcher:
   526   <patternmatcher patterns='(?:(?:|.*/)Procyonidae\\/.*$)'>
   526   <patternmatcher patterns='(?:(?:|.*/)Procyonidae/.*$)'>
   527   f  mammals/Procyonidae/cacomistle  mammals/Procyonidae/cacomistle
   527   f  mammals/Procyonidae/cacomistle  mammals/Procyonidae/cacomistle
   528   f  mammals/Procyonidae/coatimundi  mammals/Procyonidae/coatimundi
   528   f  mammals/Procyonidae/coatimundi  mammals/Procyonidae/coatimundi
   529   f  mammals/Procyonidae/raccoon     mammals/Procyonidae/raccoon
   529   f  mammals/Procyonidae/raccoon     mammals/Procyonidae/raccoon
   530   $ hg debugwalk -v 'relglob:Procyonidae/**' fennel
   530   $ hg debugwalk -v 'relglob:Procyonidae/**' fennel
   531   * matcher:
   531   * matcher:
   532   <patternmatcher patterns='(?:(?:|.*/)Procyonidae\\/.*$|fennel(?:/|$))'>
   532   <patternmatcher patterns='(?:(?:|.*/)Procyonidae/.*$|fennel(?:/|$))'>
   533   f  fennel                          fennel                          exact
   533   f  fennel                          fennel                          exact
   534   f  mammals/Procyonidae/cacomistle  mammals/Procyonidae/cacomistle
   534   f  mammals/Procyonidae/cacomistle  mammals/Procyonidae/cacomistle
   535   f  mammals/Procyonidae/coatimundi  mammals/Procyonidae/coatimundi
   535   f  mammals/Procyonidae/coatimundi  mammals/Procyonidae/coatimundi
   536   f  mammals/Procyonidae/raccoon     mammals/Procyonidae/raccoon
   536   f  mammals/Procyonidae/raccoon     mammals/Procyonidae/raccoon
   537   $ hg debugwalk -v beans 'glob:beans/*'
   537   $ hg debugwalk -v beans 'glob:beans/*'
   538   * matcher:
   538   * matcher:
   539   <patternmatcher patterns='(?:beans(?:/|$)|beans\\/[^/]*$)'>
   539   <patternmatcher patterns='(?:beans(?:/|$)|beans/[^/]*$)'>
   540   f  beans/black     beans/black
   540   f  beans/black     beans/black
   541   f  beans/borlotti  beans/borlotti
   541   f  beans/borlotti  beans/borlotti
   542   f  beans/kidney    beans/kidney
   542   f  beans/kidney    beans/kidney
   543   f  beans/navy      beans/navy
   543   f  beans/navy      beans/navy
   544   f  beans/pinto     beans/pinto
   544   f  beans/pinto     beans/pinto
   596   $ hg debugwalk -v ignored
   596   $ hg debugwalk -v ignored
   597   * matcher:
   597   * matcher:
   598   <patternmatcher patterns='(?:ignored(?:/|$))'>
   598   <patternmatcher patterns='(?:ignored(?:/|$))'>
   599   $ hg debugwalk -v ignored/file
   599   $ hg debugwalk -v ignored/file
   600   * matcher:
   600   * matcher:
   601   <patternmatcher patterns='(?:ignored\\/file(?:/|$))'>
   601   <patternmatcher patterns='(?:ignored/file(?:/|$))'>
   602   f  ignored/file  ignored/file  exact
   602   f  ignored/file  ignored/file  exact
   603 
   603 
   604 Test listfile and listfile0
   604 Test listfile and listfile0
   605 
   605 
   606   $ $PYTHON -c "open('listfile0', 'wb').write(b'fenugreek\0new\0')"
   606   $ $PYTHON -c "open('listfile0', 'wb').write(b'fenugreek\0new\0')"
   610   f  fenugreek  fenugreek
   610   f  fenugreek  fenugreek
   611   f  new        new
   611   f  new        new
   612   $ $PYTHON -c "open('listfile', 'wb').write(b'fenugreek\nnew\r\nmammals/skunk\n')"
   612   $ $PYTHON -c "open('listfile', 'wb').write(b'fenugreek\nnew\r\nmammals/skunk\n')"
   613   $ hg debugwalk -v -I 'listfile:listfile'
   613   $ hg debugwalk -v -I 'listfile:listfile'
   614   * matcher:
   614   * matcher:
   615   <includematcher includes='(?:fenugreek(?:/|$)|new(?:/|$)|mammals\\/skunk(?:/|$))'>
   615   <includematcher includes='(?:fenugreek(?:/|$)|new(?:/|$)|mammals/skunk(?:/|$))'>
   616   f  fenugreek      fenugreek
   616   f  fenugreek      fenugreek
   617   f  mammals/skunk  mammals/skunk
   617   f  mammals/skunk  mammals/skunk
   618   f  new            new
   618   f  new            new
   619 
   619 
   620   $ cd ..
   620   $ cd ..
   621   $ hg debugwalk -v -R t t/mammals/skunk
   621   $ hg debugwalk -v -R t t/mammals/skunk
   622   * matcher:
   622   * matcher:
   623   <patternmatcher patterns='(?:mammals\\/skunk(?:/|$))'>
   623   <patternmatcher patterns='(?:mammals/skunk(?:/|$))'>
   624   f  mammals/skunk  t/mammals/skunk  exact
   624   f  mammals/skunk  t/mammals/skunk  exact
   625   $ mkdir t2
   625   $ mkdir t2
   626   $ cd t2
   626   $ cd t2
   627   $ hg debugwalk -v -R ../t ../t/mammals/skunk
   627   $ hg debugwalk -v -R ../t ../t/mammals/skunk
   628   * matcher:
   628   * matcher:
   629   <patternmatcher patterns='(?:mammals\\/skunk(?:/|$))'>
   629   <patternmatcher patterns='(?:mammals/skunk(?:/|$))'>
   630   f  mammals/skunk  ../t/mammals/skunk  exact
   630   f  mammals/skunk  ../t/mammals/skunk  exact
   631   $ hg debugwalk -v --cwd ../t mammals/skunk
   631   $ hg debugwalk -v --cwd ../t mammals/skunk
   632   * matcher:
   632   * matcher:
   633   <patternmatcher patterns='(?:mammals\\/skunk(?:/|$))'>
   633   <patternmatcher patterns='(?:mammals/skunk(?:/|$))'>
   634   f  mammals/skunk  mammals/skunk  exact
   634   f  mammals/skunk  mammals/skunk  exact
   635 
   635 
   636   $ cd ..
   636   $ cd ..
   637 
   637 
   638 Test split patterns on overflow
   638 Test split patterns on overflow