log: make log work even if first parameter doesn't exist
authorMads Kiilerich <mads@kiilerich.com>
Tue, 15 Jan 2013 01:05:12 +0100
changeset 18340 8802277c40ee
parent 18339 aadefcee1f5e
child 18341 ed23d6100dd3
log: make log work even if first parameter doesn't exist A slowpath optimization kicked in too often because of wrong indentation.
mercurial/cmdutil.py
tests/test-log.t
--- a/mercurial/cmdutil.py	Tue Jan 15 01:05:12 2013 +0100
+++ b/mercurial/cmdutil.py	Tue Jan 15 01:05:12 2013 +0100
@@ -1137,8 +1137,8 @@
             for path in match.files():
                 if path == '.' or path in repo.store:
                     break
-                else:
-                    return []
+            else:
+                return []
 
     if slowpath:
         # We have to read the changelog to match filenames against
--- a/tests/test-log.t	Tue Jan 15 01:05:12 2013 +0100
+++ b/tests/test-log.t	Tue Jan 15 01:05:12 2013 +0100
@@ -34,6 +34,32 @@
   date:        Thu Jan 01 00:00:01 1970 +0000
   summary:     a
   
+log on directory
+
+  $ hg log dir
+  changeset:   4:7e4639b4691b
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:05 1970 +0000
+  summary:     e
+  
+  changeset:   2:f8954cd4dc1f
+  user:        test
+  date:        Thu Jan 01 00:00:03 1970 +0000
+  summary:     c
+  
+  $ hg log somethingthatdoesntexist dir
+  changeset:   4:7e4639b4691b
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:05 1970 +0000
+  summary:     e
+  
+  changeset:   2:f8954cd4dc1f
+  user:        test
+  date:        Thu Jan 01 00:00:03 1970 +0000
+  summary:     c
+  
 
 -f, directory