add -p to hg tip

TK Soh teekaysoh at yahoo.com
Sat Aug 27 21:50:49 CDT 2005


I find myself using 'hg tip' more these days. So having the -p can save the
trouble of having to switch to 'hg log'.

# HG changeset patch
# User TK Soh <teekaysoh at yahoo.com>
# Node ID 2874fe986f0c373fbbf28a283a47f637fa507eb1
# Parent  1032a505488ce22ab6c41d5cec877d082f9dff5e
Added -p option to 'hg tip' to show patch

diff -r 1032a505488c -r 2874fe986f0c doc/hg.1.txt
--- a/doc/hg.1.txt	Sun Aug 28 01:11:32 2005
+++ b/doc/hg.1.txt	Sun Aug 28 02:46:41 2005
@@ -469,8 +469,11 @@
 
     This lists both regular and local tags.
 
-tip::
+tip [-p]::
     Show the tip revision.
+
+    options:
+    -p, --patch           show patch
 
 undo::
     Undo the last commit or pull transaction.
diff -r 1032a505488c -r 2874fe986f0c mercurial/commands.py
--- a/mercurial/commands.py	Sun Aug 28 01:11:32 2005
+++ b/mercurial/commands.py	Sun Aug 28 02:46:41 2005
@@ -1404,11 +1404,15 @@
             r = "    ?:?"
         ui.write("%-30s %s\n" % (t, r))
 
-def tip(ui, repo):
+def tip(ui, repo, **opts):
     """show the tip revision"""
     n = repo.changelog.tip()
     show_changeset(ui, repo, changenode=n)
 
+    if opts['patch']:
+        prev, other = repo.changelog.parents(n)
+        dodiff(ui, ui, repo, prev, n)
+    
 def undo(ui, repo):
     """undo the last commit or pull
 
@@ -1640,7 +1644,9 @@
           ('u', 'user', "", 'user')],
          'hg tag [OPTION]... NAME [REV]'),
     "tags": (tags, [], 'hg tags'),
-    "tip": (tip, [], 'hg tip'),
+    "tip": (tip, 
+         [('p', 'patch', None, 'show patch')],
+         'hg tip [-p]'),
     "undo": (undo, [], 'hg undo'),
     "^update|up|checkout|co":
         (update,


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the Mercurial mailing list