hg.rst
changeset 894 d7b21de5bb44
parent 886 9b179c44f835
child 895 41b0efe7f3b7
equal deleted inserted replaced
893:50b41a290439 894:d7b21de5bb44
    90 rename path/to/source path/to/destination
    90 rename path/to/source path/to/destination
    91 ...
    91 ...
    92 EOF
    92 EOF
    93   $ hg convert --filemap filemap.txt $repo_orig $repo_new
    93   $ hg convert --filemap filemap.txt $repo_orig $repo_new
    94   $ hg -R $repo_new up
    94   $ hg -R $repo_new up
       
    95 
       
    96 ** Fix branch names.
       
    97 
       
    98 
    95 
    99 
    96 * Join history of two repos.
   100 * Join history of two repos.
    97 
   101 
    98   $ cat >filemap1.txt <<EOF
   102   $ cat >filemap1.txt <<EOF
    99 rename . dir1
   103 rename . dir1
   335   $ patch -p1 <.diff
   339   $ patch -p1 <.diff
   336 
   340 
   337   http://mercurial.selenic.com/wiki/TipsAndTricks#Merge_or_rebase_with_uncommitted_changes
   341   http://mercurial.selenic.com/wiki/TipsAndTricks#Merge_or_rebase_with_uncommitted_changes
   338   http://mercurial.selenic.com/wiki/ShelveExtension
   342   http://mercurial.selenic.com/wiki/ShelveExtension
   339 
   343 
       
   344 * Hooks.
       
   345 
       
   346 ** Check for bad branch names.
       
   347 
       
   348 .hg/hgcheck.py::
       
   349 
       
   350   import re
       
   351   goodbranch_re = r'((bug|feature)#\d|release-1\.\d\.\d|default)$'
       
   352   def precommit_badbranchname(ui, repo, hooktype, **kwargs):
       
   353       ui.warn('"%s" hook failed\n' % hooktype)
       
   354       for rev in repo:
       
   355           branch = repo[rev].branch()
       
   356           re_ = re.compile(goodbranch_re)
       
   357           if not re_.match(branch):
       
   358               ui.warn('Invalid branch name "%s".\nUse one of default, bug#ID, feature#ID or release-1.XX.XX.\n' % branch)
       
   359               return True
       
   360       return False
       
   361 
       
   362 .hg/hgrc::
       
   363 
       
   364   [hooks]
       
   365   precommit.badbranchname = python:.hg/hgcheck.py:precommit_badbranchname
       
   366   # precommit.gg = python:my.hgcheck.py.precommit_badbranch
       
   367   prechangegroup.badbranchname = python:.hg/hgcheck.py:precommit_badbranchname
       
   368 
       
   369 Read more:
       
   370 
       
   371   http://mercurial.selenic.com/wiki/HookExamples
       
   372