Patchwork [evolve-ext:stable,V2] evolve: abort when trying to move a node on top of itself

login
register
mail settings
Submitter Olle Lundberg
Date March 25, 2014, 11:39 p.m.
Message ID <8da189662f32150deffd.1395790757@se-c02kq0dadr55.lan>
Download mbox | patch
Permalink /patch/4068/
State Not Applicable
Headers show

Comments

Olle Lundberg - March 25, 2014, 11:39 p.m.
# HG changeset patch
# User Olle Lundberg <geek@nerd.sh>
# Date 1395790694 -3600
#      Wed Mar 26 00:38:14 2014 +0100
# Branch stable
# Node ID 8da189662f32150deffd032a759285562244425a
# Parent  6a67606e1c3456c603707fe57e8404af5e33a1bd
evolve: abort when trying to move a node on top of itself

This provides a clearer error message when evolve misstakenly tries
to move a changeset on top of itself. Before we got an abort with a
cryptic message about trying to rebase a merge changeset.

A proper fix to make sure that evolve never tries to move a node on
top of itself will come in later patches.
Pierre-Yves David - March 27, 2014, 6:22 p.m.
On 03/25/2014 04:39 PM, Olle Lundberg wrote:
> # HG changeset patch
> # User Olle Lundberg <geek@nerd.sh>
> # Date 1395790694 -3600
> #      Wed Mar 26 00:38:14 2014 +0100
> # Branch stable
> # Node ID 8da189662f32150deffd032a759285562244425a
> # Parent  6a67606e1c3456c603707fe57e8404af5e33a1bd
> evolve: abort when trying to move a node on top of itself
>
> This provides a clearer error message when evolve misstakenly tries
> to move a changeset on top of itself. Before we got an abort with a
> cryptic message about trying to rebase a merge changeset.
>
> A proper fix to make sure that evolve never tries to move a node on
> top of itself will come in later patches.

pushed, thanks alot

Patch

diff --git a/hgext/evolve.py b/hgext/evolve.py
--- a/hgext/evolve.py
+++ b/hgext/evolve.py
@@ -736,10 +736,16 @@ 
     pass
 
 def relocate(repo, orig, dest):
     """rewrite <rev> on dest"""
     try:
+        if orig.rev() == dest.rev():
+            raise util.Abort(_('tried to relocade a node on top of itself'),
+                             hint=_("This shouldn't happen. If you still "
+                                    "need to move changesets, please do so "
+                                    "manually with `hg rebase`"))
+
         rebase = extensions.find('rebase')
         # dummy state to trick rebase node
         if not orig.p2().rev() == node.nullrev:
             raise util.Abort(
                 'no support for evolution merge changesets yet',