Patchwork [3,of,4] graft: give helpful warning for empty grafts

login
register
mail settings
Submitter Mads Kiilerich
Date Dec. 9, 2014, 3:11 a.m.
Message ID <4cb3b2d2dc468c0bf4b2.1418094717@localhost.localdomain>
Download mbox | patch
Permalink /patch/7030/
State Accepted
Commit dc82f1a7436d12fef500efc7058f159dca75bf60
Headers show

Comments

Mads Kiilerich - Dec. 9, 2014, 3:11 a.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1418092703 -3600
#      Tue Dec 09 03:38:23 2014 +0100
# Node ID 4cb3b2d2dc468c0bf4b293412dacc204c84a6a6b
# Parent  951d216169aa9849b94f1ece60f07a8b3931ed3c
graft: give helpful warning for empty grafts

It was just showing a status message with the internal revision number.
Instead, show a warning like
  graft of 27:3aaa8b6725f0 "28" is empty

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3495,7 +3495,8 @@  def graft(ui, repo, *revs, **opts):
             node = repo.commit(text=message, user=user,
                         date=date, extra=extra, editor=editor)
             if node is None:
-                ui.status(_('graft for revision %s is empty\n') % ctx.rev())
+                ui.warn(_('note: graft of %s is empty and disappears\n') %
+                        desc)
     finally:
         wlock.release()
 
diff --git a/tests/test-graft.t b/tests/test-graft.t
--- a/tests/test-graft.t
+++ b/tests/test-graft.t
@@ -717,3 +717,4 @@  Empty graft
   $ hg tag -f something
   $ hg graft -qr 27
   $ hg graft -qf 27
+  note: graft of 27:3aaa8b6725f0 "28" is empty and disappears