[PATCH] graft: print a message when nothing was grafted (issue3091)

Matt Mackall mpm at selenic.com
Tue Nov 8 15:06:34 CST 2011


On Tue, 2011-11-08 at 21:45 +0100, Stefano Tortarolo wrote:
> # HG changeset patch
> # User Stefano Tortarolo <stefano.tortarolo at gmail.com>
> # Date 1320785084 -3600
> # Node ID cd713156b2bf17cb9085d7bf295e3c8e3b39c75f
> # Parent  de7e2fba4326cad80bda0cb100d2ae2f58e67ee8
> graft: print a message when nothing was grafted (issue3091)

This is probably the wrong solution.

Instead, we should have the inverse of the existing duplicate test:

http://www.selenic.com/hg/file/de7e2fba4326/mercurial/commands.py#l2550

We don't want to allow:

- grafting C onto a branch containing C' (already tested)
- grafting C' onto C (your case)
- grafting different C's onto each other

So something like:

for each changeset to graft:
  identities[node] = rev
  if source:
    identities[source] = rev

for each changeset in the target branch:  
  if node in identities or source in identities:
    found a duplicate, skip
    
A closely related question is what 'source' to set for a graft of a
graft. We should probably copy the original source.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list