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

login
register
mail settings
Submitter Mads Kiilerich
Date Jan. 14, 2013, 3:42 p.m.
Message ID <0002bbd903171aa20826.1358178133@mk-desktop>
Download mbox | patch
Permalink /patch/595/
State Accepted
Commit 8802277c40ee4f67c6d2cc4cb1fc44628392d38e
Headers show

Comments

Mads Kiilerich - Jan. 14, 2013, 3:42 p.m.
# HG changeset patch
# User Mads Kiilerich <madski@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.
Bryan O'Sullivan - Jan. 14, 2013, 6:12 p.m.
On Mon, Jan 14, 2013 at 7:42 AM, Mads Kiilerich <mads@kiilerich.com> wrote:

> log: make log work even if first parameter doesn't exist
>

Nice catch. Looks good.
Mads Kiilerich - Jan. 15, 2013, 12:41 a.m.
Bryan O'Sullivan wrote, On 01/14/2013 07:12 PM:
> On Mon, Jan 14, 2013 at 7:42 AM, Mads Kiilerich <mads@kiilerich.com 
> <mailto:mads@kiilerich.com>> wrote:
>
>     log: make log work even if first parameter doesn't exist
>
>
> Nice catch. Looks good. 

Crewed.

/Mads

Patch

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