Patchwork D7377: commands: log --line-range is incompatible with --copies

login
register
mail settings
Submitter phabricator
Date Nov. 14, 2019, 3:52 a.m.
Message ID <differential-rev-PHID-DREV-qcggkxxpr2s6rj6dvbut-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/43178/
State Superseded
Headers show

Comments

phabricator - Nov. 14, 2019, 3:52 a.m.
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This was (to my surprise) detected by pytype.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7377

AFFECTED FILES
  mercurial/commands.py

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-devel
phabricator - Nov. 14, 2019, 8:51 a.m.
dlax added a comment.


  Nice pytype catch!
  
  That's a bug, I think. `logcmdutil.getlinerangerevs()` should return `revs` as a smartset, not as list. I'll work on a fix.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7377/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7377

To: durin42, #hg-reviewers
Cc: dlax, mercurial-devel
phabricator - Nov. 14, 2019, 9:17 p.m.
durin42 added a comment.
durin42 abandoned this revision.


  @dlax  seems to have fixed the underlying issue here. :)

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7377/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7377

To: durin42, #hg-reviewers
Cc: dlax, mercurial-devel

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4716,6 +4716,9 @@ 
         raise error.Abort(
             _(b'FILE arguments are not compatible with --line-range option')
         )
+    copies = opts.get(b'copies')
+    if linerange and copies:
+        raise error.Abort(_(b'--line-range is incompatible with --copies'))
 
     repo = scmutil.unhidehashlikerevs(repo, opts.get(b'rev'), b'nowarn')
     revs, differ = logcmdutil.getrevs(repo, pats, opts)
@@ -4725,7 +4728,7 @@ 
         revs, differ = logcmdutil.getlinerangerevs(repo, revs, opts)
 
     getcopies = None
-    if opts.get(b'copies'):
+    if copies:
         endrev = None
         if revs:
             endrev = revs.max() + 1