[PATCH 1 of 6] Add --import-branch option to hg import to pull in branch information without --exact

Eric Hopper hopper at omnifarious.org
Thu Jun 7 22:57:59 UTC 2007


# HG changeset patch
# User Eric Hopper <hopper at omnifarious.org>
# Date 1181256550 25200
# Node ID 04f49562a1eb805adfa78349c64561a539538e6f
# Parent  5a9e767c29084e97a4dedb173ae42f77732a6306
Add --import-branch option to hg import to pull in branch information without --exact

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1548,7 +1548,6 @@ def import_(ui, repo, patch1, *patches, 
                 if p1 != wp[0].node():
                     hg.clean(repo, p1, wlock=wlock)
                 repo.dirstate.setparents(p1, p2)
-                repo.dirstate.setbranch(branch or 'default')
             elif p2:
                 try:
                     p1 = repo.lookup(p1)
@@ -1557,6 +1556,8 @@ def import_(ui, repo, patch1, *patches, 
                         repo.dirstate.setparents(p1, p2)
                 except hg.RepoError:
                     pass
+            if opts.get('exact') or opts.get('import-branch'):
+                repo.dirstate.setbranch(branch or 'default')
 
             files = {}
             try:
@@ -2835,7 +2836,9 @@ table = {
           ('f', 'force', None,
            _('skip check for outstanding uncommitted changes')),
           ('', 'exact', None,
-           _('apply patch to the nodes from which it was generated'))] + commitopts,
+           _('apply patch to the nodes from which it was generated')),
+          ('', 'import-branch', None,
+           _('Use any branch information in patch (implied by --exact)'))] + commitopts,
          _('hg import [-p NUM] [-m MESSAGE] [-f] PATCH...')),
     "incoming|in": (incoming,
          [('M', 'no-merges', None, _('do not show merges')),

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-devel/attachments/20070607/b1c6b7d7/attachment.asc>


More information about the Mercurial-devel mailing list