Patchwork D9360: commands: fix checking of share safe requirement on `config --shared`

login
register
mail settings
Submitter phabricator
Date Nov. 21, 2020, 1:08 p.m.
Message ID <differential-rev-PHID-DREV-tdugaj6nlh7sq2aue736-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47638/
State Superseded
Headers show

Comments

phabricator - Nov. 21, 2020, 1:08 p.m.
pulkit created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The `if requirements.SHARESAFE_REQUIREMENT in ...` was wrongly placed inside
  another if statement which made the check unreachable.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/commands.py

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2227,13 +2227,13 @@ 
                 raise error.InputError(
                     _(b"repository is not shared; can't use --shared")
                 )
-                if requirements.SHARESAFE_REQUIREMENT not in repo.requirements:
-                    raise error.InputError(
-                        _(
-                            b"share safe feature not unabled; "
-                            b"unable to edit shared source repository config"
-                        )
+            if requirements.SHARESAFE_REQUIREMENT not in repo.requirements:
+                raise error.InputError(
+                    _(
+                        b"share safe feature not enabled; "
+                        b"unable to edit shared source repository config"
                     )
+                )
             paths = [vfsmod.vfs(repo.sharedpath).join(b'hgrc')]
         elif opts.get(b'non_shared'):
             paths = [repo.vfs.join(b'hgrc-not-shared')]