Patchwork D2956: inifnitepush: use utils.{stringutil|procutil}.* instead of util.*

login
register
mail settings
Submitter phabricator
Date March 27, 2018, 12:38 p.m.
Message ID <differential-rev-PHID-DREV-jv7poahjzckceh5aw2lf-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/29905/
State Superseded
Headers show

Comments

phabricator - March 27, 2018, 12:38 p.m.
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Recently in core, util.py is splitted into various modules in mercurial/utils/.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/infinitepush/__init__.py
  hgext/infinitepush/fileindexapi.py

CHANGE DETAILS




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

Patch

diff --git a/hgext/infinitepush/fileindexapi.py b/hgext/infinitepush/fileindexapi.py
--- a/hgext/infinitepush/fileindexapi.py
+++ b/hgext/infinitepush/fileindexapi.py
@@ -15,7 +15,7 @@ 
 
 import os
 
-from mercurial import util
+from mercurial.utils import stringutil
 
 from . import indexapi
 
@@ -77,7 +77,7 @@ 
     def _listbookmarks(self, pattern):
         if pattern.endswith('*'):
             pattern = 're:^' + pattern[:-1] + '.*'
-        kind, pat, matcher = util.stringmatcher(pattern)
+        kind, pat, matcher = stringutil.stringmatcher(pattern)
         prefixlen = len(self._bookmarkmap) + 1
         for dirpath, _, books in self._repo.vfs.walk(self._bookmarkmap):
             for book in books:
diff --git a/hgext/infinitepush/__init__.py b/hgext/infinitepush/__init__.py
--- a/hgext/infinitepush/__init__.py
+++ b/hgext/infinitepush/__init__.py
@@ -101,6 +101,11 @@ 
 
 from mercurial.i18n import _
 
+from mercurial.utils import (
+    procutil,
+    stringutil,
+)
+
 from mercurial import (
     bundle2,
     changegroup,
@@ -272,7 +277,8 @@ 
     scratchbranchpat = ui.config('infinitepush', 'branchpattern')
     if scratchbranchpat:
         global _scratchbranchmatcher
-        kind, pat, _scratchbranchmatcher = util.stringmatcher(scratchbranchpat)
+        kind, pat, _scratchbranchmatcher = \
+                stringutil.stringmatcher(scratchbranchpat)
 
 def serverextsetup(ui):
     origpushkeyhandler = bundle2.parthandlermapping['pushkey']
@@ -333,7 +339,7 @@ 
             results.update(index.getbookmarks(pattern))
             if pattern.endswith('*'):
                 pattern = 're:^' + pattern[:-1] + '.*'
-            kind, pat, matcher = util.stringmatcher(pattern)
+            kind, pat, matcher = stringutil.stringmatcher(pattern)
             for bookmark, node in bookmarks.iteritems():
                 if matcher(bookmark):
                     results[bookmark] = node
@@ -845,7 +851,7 @@ 
     if not logger:
         ui = op.repo.ui
         try:
-            username = util.getuser()
+            username = procutil.getuser()
         except Exception:
             username = 'unknown'
         # Generate random request id to be able to find all logged entries