Make log --follow revision range start default to working dir parent.
authorBrendan Cully <brendan@kublai.com>
Thu, 03 Aug 2006 13:29:31 -0700
changeset 2783 2e0cd25fe4ac
parent 2782 21e571c21a6b
child 2784 12a7bfcafd8f
Make log --follow revision range start default to working dir parent.
mercurial/commands.py
--- 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