changeset 44573:9f5e94bbc606

fix: move handling of --all into getrevstofix() for consistency Differential Revision: https://phab.mercurial-scm.org/D8286
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 12 Dec 2019 16:32:01 -0800
parents 245aec57d76a
children 5205b46bd887
files hgext/fix.py
diffstat 1 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/fix.py	Wed Mar 18 14:26:47 2020 +0100
+++ b/hgext/fix.py	Thu Dec 12 16:32:01 2019 -0800
@@ -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