Skip to content

Commit

Permalink
Bug 1393242 - Vendor python-hglib 2.4; r=mshal
Browse files Browse the repository at this point in the history
python-hglib is a Python client for Mercurial's command server. It
facilitates querying Mercurial efficiently (using a single process)
and without having to parse output in the common case.

Let's vendor it so we can make use of it for more advanced Mercurial
scenarios.

Content vendored from changeset 820d7c1e470a without modifications
(other than deleting unwanted files).

As part of vendoring, we add the package to the virtualenv and make
it available to mach.

MozReview-Commit-ID: F4KLbW1lAvk

--HG--
extra : rebase_source : ad81f3aa4843312d300d80ce563d40736af2c16a
  • Loading branch information
indygreg committed Aug 23, 2017
1 parent b2e9cd1 commit d369594
Show file tree
Hide file tree
Showing 10 changed files with 2,330 additions and 0 deletions.
1 change: 1 addition & 0 deletions build/virtualenv_packages.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ mozilla.pth:third_party/python/configobj
mozilla.pth:third_party/python/cram
mozilla.pth:third_party/python/dlmanager
mozilla.pth:third_party/python/futures
mozilla.pth:third_party/python/hglib
mozilla.pth:third_party/python/jsmin
optional:setup.py:third_party/python/psutil:build_ext:--inplace
mozilla.pth:third_party/python/psutil
Expand Down
20 changes: 20 additions & 0 deletions third_party/python/hglib/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright (c) 2011 Matt Mackall and other contributors

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
40 changes: 40 additions & 0 deletions third_party/python/hglib/hglib/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import subprocess
from hglib import client, util, error

HGPATH = 'hg'

def open(path=None, encoding=None, configs=None):
'''starts a cmdserver for the given path (or for a repository found
in the cwd). HGENCODING is set to the given encoding. configs is a
list of key, value, similar to those passed to hg --config.
'''
return client.hgclient(path, encoding, configs)

def init(dest=None, ssh=None, remotecmd=None, insecure=False,
encoding=None, configs=None):
args = util.cmdbuilder('init', dest, e=ssh, remotecmd=remotecmd,
insecure=insecure)

args.insert(0, HGPATH)
proc = util.popen(args)
out, err = proc.communicate()
if proc.returncode:
raise error.CommandError(args, proc.returncode, out, err)

return client.hgclient(dest, encoding, configs, connect=False)

def clone(source=None, dest=None, noupdate=False, updaterev=None, rev=None,
branch=None, pull=False, uncompressed=False, ssh=None, remotecmd=None,
insecure=False, encoding=None, configs=None):
args = util.cmdbuilder('clone', source, dest, noupdate=noupdate,
updaterev=updaterev, rev=rev, branch=branch,
pull=pull, uncompressed=uncompressed,
e=ssh, remotecmd=remotecmd, insecure=insecure)

args.insert(0, HGPATH)
proc = util.popen(args)
out, err = proc.communicate()
if proc.returncode:
raise error.CommandError(args, proc.returncode, out, err)

return client.hgclient(dest, encoding, configs, connect=False)
Loading

0 comments on commit d369594

Please sign in to comment.