tests/test-fix.t
changeset 42673 74b4cd091e0d
parent 42663 4b04244f2d5f
child 42756 ed0da6e0d6ee
equal deleted inserted replaced
42672:51a2e3102db2 42673:74b4cd091e0d
   213       files in the working copy were updated. Provides a list "$HG_METADATA"
   213       files in the working copy were updated. Provides a list "$HG_METADATA"
   214       mapping fixer tool names to lists of metadata values returned from
   214       mapping fixer tool names to lists of metadata values returned from
   215       executions that modified a file. This aggregates the same metadata
   215       executions that modified a file. This aggregates the same metadata
   216       previously passed to the "postfixfile" hook.
   216       previously passed to the "postfixfile" hook.
   217   
   217   
       
   218   Fixer tools are run the in repository's root directory. This allows them to
       
   219   read configuration files from the working copy, or even write to the working
       
   220   copy. The working copy is not updated to match the revision being fixed. In
       
   221   fact, several revisions may be fixed in parallel. Writes to the working copy
       
   222   are not amended into the revision being fixed; fixer tools should always write
       
   223   fixed file content back to stdout as documented above.
       
   224   
   218   list of commands:
   225   list of commands:
   219   
   226   
   220    fix           rewrite file content in changesets or working directory
   227    fix           rewrite file content in changesets or working directory
   221   
   228   
   222   (use 'hg help -v -e fix' to show built-in aliases and global options)
   229   (use 'hg help -v -e fix' to show built-in aliases and global options)
  1267   $ hg cat -r 2 foo
  1274   $ hg cat -r 2 foo
  1268   ab
  1275   ab
  1269 
  1276 
  1270   $ cd ..
  1277   $ cd ..
  1271 
  1278 
       
  1279 We run fixer tools in the repo root so they can look for config files or other
       
  1280 important things in the working directory. This does NOT mean we are
       
  1281 reconstructing a working copy of every revision being fixed; we're just giving
       
  1282 the tool knowledge of the repo's location in case it can do something
       
  1283 reasonable with that.
       
  1284 
       
  1285   $ hg init subprocesscwd
       
  1286   $ cd subprocesscwd
       
  1287 
       
  1288   $ cat >> .hg/hgrc <<EOF
       
  1289   > [fix]
       
  1290   > printcwd:command = pwd
       
  1291   > printcwd:pattern = path:foo/bar
       
  1292   > EOF
       
  1293 
       
  1294   $ mkdir foo
       
  1295   $ printf "bar\n" > foo/bar
       
  1296   $ hg commit -Aqm blah
       
  1297 
       
  1298   $ hg fix -w -r . foo/bar
       
  1299   $ hg cat -r tip foo/bar
       
  1300   $TESTTMP/subprocesscwd
       
  1301   $ cat foo/bar
       
  1302   $TESTTMP/subprocesscwd
       
  1303 
       
  1304   $ cd foo
       
  1305 
       
  1306   $ hg fix -w -r . bar
       
  1307   $ hg cat -r tip bar
       
  1308   $TESTTMP/subprocesscwd
       
  1309   $ cat bar
       
  1310   $TESTTMP/subprocesscwd
       
  1311 
       
  1312   $ cd ../..
       
  1313 
  1272 Tools configured without a pattern are ignored. It would be too dangerous to
  1314 Tools configured without a pattern are ignored. It would be too dangerous to
  1273 run them on all files, because this might happen while testing a configuration
  1315 run them on all files, because this might happen while testing a configuration
  1274 that also deletes all of the file content. There is no reasonable subset of the
  1316 that also deletes all of the file content. There is no reasonable subset of the
  1275 files to use as a default. Users should be explicit about what files are
  1317 files to use as a default. Users should be explicit about what files are
  1276 affected by a tool. This test also confirms that we don't crash when the
  1318 affected by a tool. This test also confirms that we don't crash when the