Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Unified Diff: third_party/logilab/common/hg.py

Issue 739393004: Revert "Revert "pylint: upgrade to 1.3.1"" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/logilab/common/graph.py ('k') | third_party/logilab/common/logging_ext.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/logilab/common/hg.py
===================================================================
--- third_party/logilab/common/hg.py (revision 293047)
+++ third_party/logilab/common/hg.py (working copy)
@@ -1,130 +0,0 @@
-# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of logilab-common.
-#
-# logilab-common is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option) any
-# later version.
-#
-# logilab-common is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
-"""mercurial utilities (mercurial should be installed)"""
-
-__docformat__ = "restructuredtext en"
-
-import os
-import sys
-import os.path as osp
-
-try:
- from mercurial.error import RepoError
- from mercurial.__version__ import version as hg_version
-except ImportError:
- from mercurial.repo import RepoError
- from mercurial.version import get_version
- hg_version = get_version()
-
-from mercurial.hg import repository as Repository
-from mercurial.ui import ui as Ui
-from mercurial.node import short
-try:
- # mercurial >= 1.2 (?)
- from mercurial.cmdutil import walkchangerevs
-except ImportError, ex:
- from mercurial.commands import walkchangerevs
-try:
- # mercurial >= 1.1 (.1?)
- from mercurial.util import cachefunc
-except ImportError, ex:
- def cachefunc(func):
- return func
-try:
- # mercurial >= 1.3.1
- from mercurial import encoding
- _encoding = encoding.encoding
-except ImportError:
- try:
- from mercurial.util import _encoding
- except ImportError:
- import locale
- # stay compatible with mercurial 0.9.1 (etch debian release)
- # (borrowed from mercurial.util 1.1.2)
- try:
- _encoding = os.environ.get("HGENCODING")
- if sys.platform == 'darwin' and not _encoding:
- # On darwin, getpreferredencoding ignores the locale environment and
- # always returns mac-roman. We override this if the environment is
- # not C (has been customized by the user).
- locale.setlocale(locale.LC_CTYPE, '')
- _encoding = locale.getlocale()[1]
- if not _encoding:
- _encoding = locale.getpreferredencoding() or 'ascii'
- except locale.Error:
- _encoding = 'ascii'
-try:
- # demandimport causes problems when activated, ensure it isn't
- # XXX put this in apycot where the pb has been noticed?
- from mercurial import demandimport
- demandimport.disable()
-except:
- pass
-
-Ui.warn = lambda *args, **kwargs: 0 # make it quiet
-
-def find_repository(path):
- """returns <path>'s mercurial repository
-
- None if <path> is not under hg control
- """
- path = osp.realpath(osp.abspath(path))
- while not osp.isdir(osp.join(path, ".hg")):
- oldpath = path
- path = osp.dirname(path)
- if path == oldpath:
- return None
- return path
-
-
-def get_repository(path):
- """Simple function that open a hg repository"""
- repopath = find_repository(path)
- if repopath is None:
- raise RuntimeError('no repository found in %s' % osp.abspath(path))
- return Repository(Ui(), path=repopath)
-
-def incoming(wdrepo, masterrepo):
- try:
- return wdrepo.findincoming(masterrepo)
- except AttributeError:
- from mercurial import hg, discovery
- revs, checkout = hg.addbranchrevs(wdrepo, masterrepo, ('', []), None)
- common, incoming, rheads = discovery.findcommonincoming(
- wdrepo, masterrepo, heads=revs)
- if not masterrepo.local():
- from mercurial import bundlerepo, changegroup
- if revs is None and masterrepo.capable('changegroupsubset'):
- revs = rheads
- if revs is None:
- cg = masterrepo.changegroup(incoming, "incoming")
- else:
- cg = masterrepo.changegroupsubset(incoming, revs, 'incoming')
- fname = changegroup.writebundle(cg, None, "HG10UN")
- # use the created uncompressed bundlerepo
- masterrepo = bundlerepo.bundlerepository(wdrepo.ui, wdrepo.root, fname)
- return masterrepo.changelog.nodesbetween(incoming, revs)[0]
-
-def outgoing(wdrepo, masterrepo):
- try:
- return wdrepo.findoutgoing(masterrepo)
- except AttributeError:
- from mercurial import hg, discovery
- revs, checkout = hg.addbranchrevs(wdrepo, wdrepo, ('', []), None)
- o = discovery.findoutgoing(wdrepo, masterrepo)
- return wdrepo.changelog.nodesbetween(o, revs)[0]
« no previous file with comments | « third_party/logilab/common/graph.py ('k') | third_party/logilab/common/logging_ext.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698