--- a/mercurial/cmdutil.py Sat Aug 23 21:23:02 2014 +0900
+++ b/mercurial/cmdutil.py Wed Aug 27 18:35:34 2014 +0200
@@ -651,6 +651,9 @@
p2 = repo[nullid]
except error.RepoError:
p1, p2 = parents
+ if p2.node() == nullid:
+ ui.warn(_("warning: import the patch as a normal revision\n"
+ "(use --exact to import the patch as a merge)\n"))
else:
p1, p2 = parents
@@ -911,9 +914,10 @@
self.ui.write(_("phase: %s\n") % _(ctx.phasestr()),
label='log.phase')
for parent in parents:
+ label = 'log.parent changeset.%s' % self.repo[parent[0]].phasestr()
# i18n: column positioning for "hg log"
self.ui.write(_("parent: %d:%s\n") % parent,
- label='log.parent changeset.%s' % ctx.phasestr())
+ label=label)
if self.ui.debugflag:
mnode = ctx.manifestnode()
--- a/mercurial/commands.py Sat Aug 23 21:23:02 2014 +0900
+++ b/mercurial/commands.py Wed Aug 27 18:35:34 2014 +0200
@@ -3221,14 +3221,23 @@
ctx = repo[rev]
n = ctx.extra().get('source')
if n in ids:
- r = repo[n].rev()
+ try:
+ r = repo[n].rev()
+ except error.RepoLookupError:
+ r = None
if r in revs:
ui.warn(_('skipping revision %s (already grafted to %s)\n')
% (r, rev))
revs.remove(r)
elif ids[n] in revs:
- ui.warn(_('skipping already grafted revision %s '
- '(%s also has origin %d)\n') % (ids[n], rev, r))
+ if r is None:
+ ui.warn(_('skipping already grafted revision %s '
+ '(%s also has unknown origin %s)\n')
+ % (ids[n], rev, n))
+ else:
+ ui.warn(_('skipping already grafted revision %s '
+ '(%s also has origin %d)\n')
+ % (ids[n], rev, r))
revs.remove(ids[n])
elif ctx.hex() in ids:
r = ids[ctx.hex()]
--- a/tests/test-graft.t Sat Aug 23 21:23:02 2014 +0900
+++ b/tests/test-graft.t Wed Aug 27 18:35:34 2014 +0200
@@ -678,3 +678,14 @@
grafting revision 28
$ cat a
abc
+
+Continue testing same origin policy, using revision numbers from test above
+but do some destructive editing of the repo:
+
+ $ hg up -qC 7
+ $ hg tag -l -r 13 tmp
+ $ hg --config extensions.mq= strip 2
+ saved backup bundle to $TESTTMP/a/.hg/strip-backup/5c095ad7e90f-backup.hg (glob)
+ $ hg graft tmp
+ skipping already grafted revision 8 (2 also has unknown origin 5c095ad7e90f871700f02dd1fa5012cb4498a2d4)
+ [255]
--- a/tests/test-import-merge.t Sat Aug 23 21:23:02 2014 +0900
+++ b/tests/test-import-merge.t Wed Aug 27 18:35:34 2014 +0200
@@ -72,6 +72,8 @@
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg import ../merge.diff
applying ../merge.diff
+ warning: import the patch as a normal revision
+ (use --exact to import the patch as a merge)
$ tipparents
2:890ecaa90481 addc
$ hg strip --no-backup tip
@@ -105,6 +107,8 @@
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg import --bypass ../merge.diff
applying ../merge.diff
+ warning: import the patch as a normal revision
+ (use --exact to import the patch as a merge)
$ tipparents
2:890ecaa90481 addc
$ hg strip --no-backup tip