[PATCH] merge with rev null fails [issue1101]

Simon Heimberg simohe at besonet.ch
Tue Sep 9 12:52:49 CDT 2008


# HG changeset patch
# User Simon Heimberg <simohe at besonet.ch>
# Date 1220982346 -7200
# Node ID 1a6213062a2d8e1f9c3df5b87f9e90d802928a73
# Parent  6dcbe191a9b51799a4cd40bd398e826bcd9b4dac
merge with rev null fails [issue1101]

diff -r 6dcbe191a9b5 -r 1a6213062a2d mercurial/merge.py
--- a/mercurial/merge.py	Mon Aug 18 16:50:36 2008 -0500
+++ b/mercurial/merge.py	Tue Sep 09 19:45:46 2008 +0200
@@ -447,6 +447,9 @@
             if pa == p2:
                 raise util.Abort(_("can't merge with ancestor"))
             elif pa == p1:
+                if fp1 == nullid:
+                    raise util.Abort(_("can not merge with null rev"
+                                       " (use 'hg update')"))                
                 if p1.branch() != p2.branch():
                     fastforward = True
                 else:
diff -r 6dcbe191a9b5 -r 1a6213062a2d tests/test-merge-issue1101
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-merge-issue1101	Tue Sep 09 19:45:46 2008 +0200
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+hg init nullmerge
+cd nullmerge
+hg branch branch1
+echo "This is foo.txt" > foo.txt
+hg add foo.txt
+hg ci -m "Added foo.txt"
+
+echo % merge with null
+hg merge -r null || echo failed
+echo % update to null
+hg update -r null
+echo % merge when working directorys parent is null
+hg merge -r null || echo failed
+
+exit 0
diff -r 6dcbe191a9b5 -r 1a6213062a2d tests/test-merge-issue1101.out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-merge-issue1101.out	Tue Sep 09 19:45:46 2008 +0200
@@ -0,0 +1,9 @@
+marked working directory as branch branch1
+% merge with null
+abort: can't merge with ancestor
+failed
+% update to null
+0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+% merge when working directorys parent is null
+abort: can't merge with ancestor
+failed



More information about the Mercurial-devel mailing list