[PATCH 1 of 2] log: make log work even if first parameter doesn't exist

Mads Kiilerich mads at kiilerich.com
Mon Jan 14 09:42:13 CST 2013


# HG changeset patch
# User Mads Kiilerich <madski at unity3d.com>
# Date 1358178087 -3600
# Node ID 0002bbd903171aa20826c5795419a75ead646e1f
# Parent  60680d691a0b483f001875213db4660d5abdd5e1
log: make log work even if first parameter doesn't exist

A slowpath optimization kicked in too often because of wrong indentation.

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -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
diff --git a/tests/test-log.t b/tests/test-log.t
--- a/tests/test-log.t
+++ b/tests/test-log.t
@@ -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
 


More information about the Mercurial-devel mailing list