tests/test-empty-file.t
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
Fri, 03 Jul 2015 06:56:03 +0900
changeset 25732 b94df10cc3b5
parent 16913 f2719b387380
permissions -rw-r--r--
hghave: allow adding customized features at runtime Before this patch, there is no way to add customized features to `hghave` without changing `hghave` and `hghave.py` themselves. This decreases reusability of `run-tests.py` framework for third party tools, because they may want to examine custom features at runtime (e.g. existence of some external tools). To allow adding customized features at runtime, this patch makes `hghave` import `hghaveaddon` module, only when `hghaveaddon.py` file can be found in directories below: - `TESTDIR` for invocation via `run-tests.py` - `.` for invocation via command line The path to the directory where `hghaveaddon.py` should be placed is added to `sys.path` only while importing `hghaveaddon`, because: - `.` may not be added to `PYTHONPATH` - adding additional path to `sys.path` may change behavior of subsequent `import` for other features `hghave` is terminated with exit code '2' at failure of `import hghaveaddon`, because exit code '2' terminates `run-tests.py` immediately. This is a one of preparations for issue4677.

  $ hg init a
  $ cd a
  $ touch empty1
  $ hg add empty1
  $ hg commit -m 'add empty1'

  $ touch empty2
  $ hg add empty2
  $ hg commit -m 'add empty2'

  $ hg up -C 0
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
  $ touch empty3
  $ hg add empty3
  $ hg commit -m 'add empty3'
  created new head

  $ hg heads
  changeset:   2:a1cb177e0d44
  tag:         tip
  parent:      0:1e1d9c4e5b64
  user:        test
  date:        Thu Jan 01 00:00:00 1970 +0000
  summary:     add empty3
  
  changeset:   1:097d2b0e17f6
  user:        test
  date:        Thu Jan 01 00:00:00 1970 +0000
  summary:     add empty2
  

  $ hg merge 1
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  (branch merge, don't forget to commit)

Before changeset 05257fd28591, we didn't notice the
empty file that came from rev 1:

  $ hg status
  M empty2
  $ hg commit -m merge
  $ hg manifest --debug tip
  b80de5d138758541c5f05265ad144ab9fa86d1db 644   empty1
  b80de5d138758541c5f05265ad144ab9fa86d1db 644   empty2
  b80de5d138758541c5f05265ad144ab9fa86d1db 644   empty3

  $ cd ..