Patchwork D1195: config: fix default config value for svn.trunk

login
register
mail settings
Submitter phabricator
Date Oct. 19, 2017, 1:36 p.m.
Message ID <differential-rev-PHID-DREV-mk6k3yvuwhorejb52pxl-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/25238/
State Superseded
Headers show

Comments

phabricator - Oct. 19, 2017, 1:36 p.m.
lothiraldan created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Instead of fallbacking on a default in code, declare the right default during
  configuration registration so the code is slightly cleaner.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/convert/__init__.py
  hgext/convert/subversion.py

CHANGE DETAILS




To: lothiraldan, #hg-reviewers
Cc: mercurial-devel
phabricator - Oct. 19, 2017, 2:54 p.m.
durin42 requested changes to this revision.
durin42 added a comment.
This revision now requires changes to proceed.


  That's not the only place it's used. I don't have it in front of me, but look for trunk in other places (it's where svn.tags and svn.branches get used as well). The other callsite *needs* the default to be None.

REPOSITORY
  rHG Mercurial

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

To: lothiraldan, #hg-reviewers, durin42
Cc: durin42, mercurial-devel
phabricator - Oct. 19, 2017, 2:58 p.m.
lothiraldan abandoned this revision.
lothiraldan added a comment.


  Indeed, the `getcfgpath` function also calls it, my bad.

REPOSITORY
  rHG Mercurial

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

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

Patch

diff --git a/hgext/convert/subversion.py b/hgext/convert/subversion.py
--- a/hgext/convert/subversion.py
+++ b/hgext/convert/subversion.py
@@ -352,10 +352,7 @@ 
                 raise error.Abort(_('svn: revision %s is not an integer') %
                                  revs[0])
 
-        trunkcfg = self.ui.config('convert', 'svn.trunk')
-        if trunkcfg is None:
-            trunkcfg = 'trunk'
-        self.trunkname = trunkcfg.strip('/')
+        self.trunkname = self.ui.config('convert', 'svn.trunk').strip('/')
         self.startrev = self.ui.config('convert', 'svn.startrev')
         try:
             self.startrev = int(self.startrev)
diff --git a/hgext/convert/__init__.py b/hgext/convert/__init__.py
--- a/hgext/convert/__init__.py
+++ b/hgext/convert/__init__.py
@@ -113,7 +113,7 @@ 
     default=True,
 )
 configitem('convert', 'svn.trunk',
-    default=None,
+    default='trunk',
 )
 configitem('convert', 'svn.tags',
     default=None,