Patchwork Solved issue4039

login
register
mail settings
Submitter Cristian Zamfir
Date March 10, 2014, 8:41 p.m.
Message ID <1394484100.71512.YahooMailNeo@web161303.mail.bf1.yahoo.com>
Download mbox | patch
Permalink /patch/3906/
State Accepted
Headers show

Comments

Cristian Zamfir - March 10, 2014, 8:41 p.m.
Good evening!

My name is Cristi Zamfir.

This is my first time contributing to an open source project. I have read the guide on how to send a patch for Mercurial. If I did anything wrong in the sending process i would like to apologize now for any inconvenience created.

Patch Description:

`hg log -r 0:null` is like `hg log -r null`(issue4039)


The command hg log -r 0:null would show only one revision (the first one -1) instead of showing the first 2 revisions. This was caused by an if condition in "scmutil.py" file at line at lines 509 - 510:

>if end == nullrev and start <= 0:
>                   start = nullrev

Commenting these 2 instructions solved the problem. I also modified test-log.t, test-glog.t  to check for the right output.

The Patch:

# HG changeset patch
# User Cristian Zamfir <cristi_zmf@yahoo.com>
# Date 1394481280 -7200
#      Mon Mar 10 21:54:40 2014 +0200
# Node ID 386c34467d86668c8fdbc1de4a54eabdb2ca227e
# Parent  19e9478c1a2245b6b5b4b2882efee5261d7df963
issue4039
Stephen Lee - March 11, 2014, 8:50 a.m.
On Tue, Mar 11, 2014 at 7:41 AM, Cristian Zamfir <cristi_zmf@yahoo.com> wrote:
>
>
> Good evening!
>
> My name is Cristi Zamfir.
>
> This is my first time contributing to an open source project. I have read the guide on how to send a patch for Mercurial. If I did anything wrong in the sending process i would like to apologize now for any inconvenience created.
>
> Patch Description:
>
> `hg log -r 0:null` is like `hg log -r null`(issue4039)
>
>
> The command hg log -r 0:null would show only one revision (the first one -1) instead of showing the first 2 revisions. This was caused by an if condition in "scmutil.py" file at line at lines 509 - 510:
>
>>if end == nullrev and start <= 0:
>>                   start = nullrev
>
> Commenting these 2 instructions solved the problem. I also modified test-log.t, test-glog.t  to check for the right output.
>
> The Patch:
>
> # HG changeset patch
> # User Cristian Zamfir <cristi_zmf@yahoo.com>
> # Date 1394481280 -7200
> #      Mon Mar 10 21:54:40 2014 +0200
> # Node ID 386c34467d86668c8fdbc1de4a54eabdb2ca227e
> # Parent  19e9478c1a2245b6b5b4b2882efee5261d7df963
> issue4039

This description doesn't match the format required for contributing:
topic: what the change does (issue12345)

>
> diff -r 19e9478c1a22 -r 386c34467d86 mercurial/scmutil.py
> --- a/mercurial/scmutil.pyThu Mar 06 17:26:49 2014 -0600
> +++ b/mercurial/scmutil.pyMon Mar 10 21:54:40 2014 +0200
> @@ -506,8 +506,8 @@
>                  start, end = spec.split(_revrangesep, 1)
>                  start = revfix(repo, start, 0)
>                  end = revfix(repo, end, len(repo) - 1)
> -                if end == nullrev and start <= 0:
> -                    start = nullrev
> +                #if end == nullrev and start <= 0:
> +                    #start = nullrev

Please remove code rather than commenting out - seeing the old code is
what a VCS like Mercurial is for!

A good first attempt - please don't get discouraged!

Steve

Patch

diff -r 19e9478c1a22 -r 386c34467d86 mercurial/scmutil.py
--- a/mercurial/scmutil.pyThu Mar 06 17:26:49 2014 -0600
+++ b/mercurial/scmutil.pyMon Mar 10 21:54:40 2014 +0200
@@ -506,8 +506,8 @@ 
                 start, end = spec.split(_revrangesep, 1)
                 start = revfix(repo, start, 0)
                 end = revfix(repo, end, len(repo) - 1)
-                if end == nullrev and start <= 0:
-                    start = nullrev
+                #if end == nullrev and start <= 0:
+                    #start = nullrev
                 rangeiter = repo.changelog.revs(start, end)
                 if not seen and not l:
                     # by far the most common case: revs = ["-1:0"]
diff -r 19e9478c1a22 -r 386c34467d86 tests/test-glog.t
--- a/tests/test-glog.tThu Mar 06 17:26:49 2014 -0600
+++ b/tests/test-glog.tMon Mar 10 21:54:40 2014 +0200
@@ -2111,6 +2111,11 @@ 
 issue3772
 
   $ hg log -G -r :null
+  o  changeset:   0:f8035bb17114
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     add a
+  |
   o  changeset:   -1:000000000000
      user:
      date:        Thu Jan 01 00:00:00 1970 +0000
diff -r 19e9478c1a22 -r 386c34467d86 tests/test-log.t
--- a/tests/test-log.tThu Mar 06 17:26:49 2014 -0600
+++ b/tests/test-log.tMon Mar 10 21:54:40 2014 +0200
@@ -1356,6 +1356,12 @@ 
 issue3772: hg log -r :null showing revision 0 as well
 
   $ hg log -r :null
+  changeset:   0:65624cd9070a
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     a bunch of weird directories
+  
   changeset:   -1:000000000000
   user:        
   date:        Thu Jan 01 00:00:00 1970 +0000