patch for issue 4423

Mads Kiilerich mads at kiilerich.com
Wed Oct 29 11:01:29 CDT 2014


On 10/28/2014 09:39 AM, Robert Collins wrote:
> Hi - resending here as apparently they can't be discussed in the bug
> tracker. This is a driveby - it fixed it for me, but I make no claims
> about correctness, other use cases or testing.

Thanks. How driveby is it?

Could you contribute an updated patch that comply with 
http://mercurial.selenic.com/wiki/ContributingChanges ? (Or actually two 
patches for what seems to be two different issues, and including test 
coverage/updates for both.)

Or is it just thrown out here take-it-or-leave-it-ish so someone else 
who cares can pick it up and take it the last mile?

/Mads

> diff -r 6df4bc39f682 hgext/transplant.py
> --- a/hgext/transplant.py Mon Oct 27 23:47:41 2014 -0500
> +++ b/hgext/transplant.py Tue Oct 28 19:55:15 2014 +1300
> @@ -302,8 +302,12 @@
>           '''recover last transaction and apply remaining changesets'''
>           if os.path.exists(os.path.join(self.path, 'journal')):
>               n, node = self.recover(repo, source, opts)
> -            self.ui.status(_('%s transplanted as %s\n') % (short(node),
> -                                                           short(n)))
> +            if n:
> +                self.ui.status(_('%s transplanted as %s\n') % (short(node),
> +                                                               short(n)))
> +            else:
> +                self.ui.status(
> +                    _('%s skipped due to empty diff\n' % (short(node),)))
>           seriespath = os.path.join(self.path, 'series')
>           if not os.path.exists(seriespath):
>               self.transplants.write()
> @@ -344,12 +348,16 @@
>                                    revlog.hex(parent))
>               if merge:
>                   repo.setparents(p1, parents[1])
> -            n = repo.commit(message, user, date, extra=extra,
> -                            editor=self.getcommiteditor())
> -            if not n:
> -                raise util.Abort(_('commit failed'))
> -            if not merge:
> -                self.transplants.set(n, node)
> +            modified, added, removed, deleted = repo.status()[:4]
> +            if modified or added or removed or deleted:
> +                n = repo.commit(message, user, date, extra=extra,
> +                                editor=self.getcommiteditor())
> +                if not n:
> +                    raise util.Abort(_('commit failed'))
> +                if not merge:
> +                    self.transplants.set(n, node)
> +            else:
> +                n = None
>               self.unlog()
>
>               return n, node


More information about the Mercurial-devel mailing list