libvcs.cmd.hg#

For mercurial, aka hg(1).

Note

At a Mercurial shop? Can you help us jimmy this module into the next Sunbeam toaster of Mercurialian perfection? We need to patch and shimmy this thing into shape and seek a skilled tradesperson to give it - in Robert M. Pirsig’s sense - care. Connect with us on the tracker. It’s not too late to change the API.

class libvcs.cmd.hg.HgColorType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: Enum

boolean = 'boolean'#
always = 'always'#
auto = 'auto'#
never = 'never'#
debug = 'debug'#
class libvcs.cmd.hg.HgPagerType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: Enum

boolean = 'boolean'#
always = 'always'#
auto = 'auto'#
never = 'never'#
class libvcs.cmd.hg.Hg(*, dir, progress_callback=None)[source]#

Bases: object

Lite, typed, pythonic wrapper for hg(1).

Parameters:

Examples

>>> Hg(dir=tmp_path)
<Hg dir=...>
__init__(*, dir, progress_callback=None)[source]#

Lite, typed, pythonic wrapper for hg(1).

Parameters:
Return type:

None

Examples

>>> Hg(dir=tmp_path)
<Hg dir=...>
dir: Path#

Directory to check out

progress_callback: Optional[ProgressCallbackProtocol] = None#
run(args, *, config=None, repository=None, quiet=None, help=None, encoding=None, encoding_mode=None, verbose=None, traceback=None, debug=None, debugger=None, profile=None, version=None, hidden=None, time=None, pager=None, color=None, check_returncode=None, **kwargs)[source]#

Passing None to a subcommand option, the flag won’t be passed unless otherwise stated.

hg help and hg help [cmd]

Wraps hg’s Options.

Parameters:
Return type:

str

Examples

>>> hg = Hg(dir=tmp_path)
>>> hg.run(['help'])
"Mercurial Distributed SCM..."
Return type:

str

Parameters:
clone(*, url, no_update=None, update_rev=None, rev=None, branch=None, ssh=None, remote_cmd=None, pull=None, stream=None, insecure=None, quiet=None, make_parents=True, check_returncode=None)[source]#

Clone a working copy from a mercurial repo.

Wraps hg clone.

Parameters:
Return type:

str

Examples

>>> hg = Hg(dir=tmp_path)
>>> hg_remote_repo = create_hg_remote_repo()
>>> hg.clone(url=f'file://{hg_remote_repo}')
'updating to branch default...1 files updated, 0 files merged, ...'
>>> hg.dir.exists()
True
Return type:

str

Parameters:
update(quiet=None, verbose=None, check_returncode=True, *args, **kwargs)[source]#

Update working directory

Wraps hg update.

Examples

>>> hg = Hg(dir=tmp_path)
>>> hg_remote_repo = create_hg_remote_repo()
>>> hg.clone(url=f'file://{hg_remote_repo}')
'updating to branch default...1 files updated, 0 files merged, ...'
>>> hg.update()
'0 files updated, 0 files merged, 0 files removed, 0 files unresolved'
Return type:

str

Parameters:
pull(quiet=None, verbose=None, update=None, check_returncode=True, *args, **kwargs)[source]#

Update working directory

Wraps hg update.

Examples

>>> hg = Hg(dir=tmp_path)
>>> hg_remote_repo = create_hg_remote_repo()
>>> hg.clone(url=f'file://{hg_remote_repo}')
'updating to branch default...1 files updated, 0 files merged, ...'
>>> hg.pull()
'pulling from ...searching for changes...no changes found'
>>> hg.pull(update=True)
'pulling from ...searching for changes...no changes found'
Return type:

str

Parameters: