tests/test-convert-authormap.t
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
Fri, 03 Jul 2015 06:56:03 +0900
changeset 25732 b94df10cc3b5
parent 16948 a0cbbf78c31a
child 35393 4441705b7111
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.


  $ cat >> $HGRCPATH <<EOF
  > [extensions]
  > convert=
  > EOF

Prepare orig repo

  $ hg init orig
  $ cd orig
  $ echo foo > foo
  $ HGUSER='user name' hg ci -qAm 'foo'
  $ cd ..

Explicit --authors

  $ cat > authormap.txt <<EOF
  > user name = Long User Name
  > 
  > # comment
  > this line is ignored
  > EOF
  $ hg convert --authors authormap.txt orig new
  initializing destination new repository
  ignoring bad line in author map file authormap.txt: this line is ignored
  scanning source...
  sorting...
  converting...
  0 foo
  writing author map file $TESTTMP/new/.hg/authormap (glob)
  $ cat new/.hg/authormap
  user name=Long User Name
  $ hg -Rnew log
  changeset:   0:d89716e88087
  tag:         tip
  user:        Long User Name
  date:        Thu Jan 01 00:00:00 1970 +0000
  summary:     foo
  
  $ rm -rf new

Implicit .hg/authormap

  $ hg init new
  $ mv authormap.txt new/.hg/authormap
  $ hg convert orig new
  ignoring bad line in author map file $TESTTMP/new/.hg/authormap: this line is ignored (glob)
  scanning source...
  sorting...
  converting...
  0 foo
  $ hg -Rnew log
  changeset:   0:d89716e88087
  tag:         tip
  user:        Long User Name
  date:        Thu Jan 01 00:00:00 1970 +0000
  summary:     foo