Patchwork D8286: fix: move handling of --all into getrevstofix() for consistency

login
register
mail settings
Submitter phabricator
Date March 13, 2020, 7:33 p.m.
Message ID <differential-rev-PHID-DREV-q5vg3q5syco4wmmyvfpv-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/45769/
State Superseded
Headers show

Comments

phabricator - March 13, 2020, 7:33 p.m.
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/fix.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel
phabricator - March 17, 2020, 3:01 a.m.
This revision now requires changes to proceed.
durin42 added a comment.
durin42 requested changes to this revision.


  LGTM but needs rebased?

REPOSITORY
  rHG Mercurial

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

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

To: martinvonz, #hg-reviewers, mharbison72, durin42
Cc: durin42, mercurial-devel

Patch

diff --git a/hgext/fix.py b/hgext/fix.py
--- a/hgext/fix.py
+++ b/hgext/fix.py
@@ -251,9 +251,7 @@ 
     opts = pycompat.byteskwargs(opts)
     cmdutil.check_at_most_one_arg(opts, b'all', b'rev')
     cmdutil.check_incompatible_arguments(opts, b'working_dir', [b'all'])
-    if opts[b'all']:
-        opts[b'rev'] = [b'not public() and not obsolete()']
-        opts[b'working_dir'] = True
+
     with repo.wlock(), repo.lock(), repo.transaction(b'fix'):
         revstofix = getrevstofix(ui, repo, opts)
         basectxs = getbasectxs(repo, opts, revstofix)
@@ -399,9 +397,12 @@ 
 
 def getrevstofix(ui, repo, opts):
     """Returns the set of revision numbers that should be fixed"""
-    revs = set(scmutil.revrange(repo, opts[b'rev']))
-    if opts.get(b'working_dir'):
-        revs.add(wdirrev)
+    if opts[b'all']:
+        revs = repo.revs(b'(not public() and not obsolete()) or wdir()')
+    else:
+        revs = set(scmutil.revrange(repo, opts[b'rev']))
+        if opts.get(b'working_dir'):
+            revs.add(wdirrev)
     for rev in revs:
         checkfixablectx(ui, repo, repo[rev])
     # Allow fixing only wdir() even if there's an unfinished operation