[PATCH] transplant: permit merge changesets via --force/-f

Steven Stallion sstallion at gmail.com
Tue Mar 27 00:54:47 CDT 2012


# HG changeset patch
# User Steven Stallion <sstallion at gmail.com>
# Date 1332827534 25200
# Node ID 4743d44e9353b643232846cfc12990bc64162573
# Parent  e53c0b2d7b6081586666579b4d0a2ffdedaac1b8
transplant: permit merge changesets via --force/-f

This change permits the transplant extension to operate on merge
changesets by way of --force/-f.  This is particularly useful for
workflows which cherrypick branch merges rather than each commit
within a branch.

diff -r e53c0b2d7b60 -r 4743d44e9353 hgext/transplant.py
--- a/hgext/transplant.py	Mon Mar 26 16:42:53 2012 -0500
+++ b/hgext/transplant.py	Mon Mar 26 22:52:14 2012 -0700
@@ -144,8 +144,8 @@
                     if not hasnode(repo, node):
                         repo.pull(source, heads=[node])
 
-                if parents[1] != revlog.nullid:
-                    self.ui.note(_('skipping merge changeset %s:%s\n')
+                if parents[1] != revlog.nullid and not opts.get('force'):
+                    self.ui.warn(_('skipping merge changeset %s:%s\n')
                                  % (rev, short(node)))
                     patchfile = None
                 else:
@@ -466,6 +466,7 @@
     ('b', 'branch', [],
      _('pull patches from branch BRANCH'), _('BRANCH')),
     ('a', 'all', None, _('pull all changesets up to BRANCH')),
+    ('f', 'force', False, _('force transplant of merge changesets')),
     ('p', 'prune', [], _('skip over REV'), _('REV')),
     ('m', 'merge', [], _('merge at REV'), _('REV')),
     ('e', 'edit', False, _('invoke editor on commit messages')),
@@ -499,7 +500,8 @@
     the branch holding the named revision, up to that revision. If
     --all/-a is specified, all changesets on the branch will be
     transplanted, otherwise you will be prompted to select the
-    changesets you want.
+    changesets you want. If --force/-f is specified, merge changesets
+    will not be skipped.
 
     :hg:`transplant --branch REVISION --all` will transplant the
     selected branch (up to the named revision) onto your current


More information about the Mercurial-devel mailing list