changeset 2783:2e0cd25fe4ac

Make log --follow revision range start default to working dir parent.
author Brendan Cully <brendan@kublai.com>
date Thu, 03 Aug 2006 13:29:31 -0700
parents 21e571c21a6b
children 12a7bfcafd8f
files mercurial/commands.py
diffstat 1 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Thu Aug 03 11:06:09 2006 -0700
+++ b/mercurial/commands.py	Thu Aug 03 13:29:31 2006 -0700
@@ -130,7 +130,17 @@
     if repo.changelog.count() == 0:
         return [], False, matchfn
 
-    revs = map(int, revrange(ui, repo, opts['rev'] or ['tip:0']))
+    if follow:
+        p = repo.dirstate.parents()[0]
+        if p == nullid:
+            ui.warn(_('No working directory revision; defaulting to tip\n'))
+            start = 'tip'
+        else:
+            start = repo.changelog.rev(p)
+        defrange = '%s:0' % start
+    else:
+        defrange = 'tip:0'
+    revs = map(int, revrange(ui, repo, opts['rev'] or [defrange]))
     wanted = {}
     slowpath = anypats
     fncache = {}
@@ -2017,6 +2027,10 @@
     renames and copies. --follow without a file name will only show
     ancestors or descendants of the starting revision.
 
+    If no revision range is specified, the default is tip:0 unless
+    --follow is set, in which case the working directory parent is
+    used as the starting revision.
+
     By default this command outputs: changeset id and hash, tags,
     non-trivial parents, user, date and time, and a summary for each
     commit. When the -v/--verbose switch is used, the list of changed