libvcs.cmd.hg¶
For mercurial, aka hg(1).
Run hg (Mercurial) commands directly against a local mercurial repo.
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.
Bases:
EnumCLI Color enum for Mercurial.
-
boolean = 'boolean'¶attribute
-
always = 'always'¶attribute
-
auto = 'auto'¶attribute
-
never = 'never'¶attribute
-
debug = 'debug'¶attribute
-
Bases:
EnumCLI Pagination enum for Mercurial.
-
boolean = 'boolean'¶attribute
-
always = 'always'¶attribute
-
auto = 'auto'¶attribute
-
never = 'never'¶attribute
-
Bases:
objectRun commands directly on a Mercurial repository.
Lite, typed, pythonic wrapper for hg(1).
- Parameters:
path (StrPath) – Operates as PATH in the corresponding hg subcommand.
progress_callback (ProgressCallbackProtocol | None)
- Return type:
Examples
>>> Hg(path=tmp_path) <Hg path=...>
-
attribute
Run a command for this Mercurial repository.
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:
quiet (bool) – -q / –quiet
repository (str) –
--repository REPOcwd (
libvcs._internal.types.StrOrBytesPath, optional) –--cwd DIR, Defaults tocwdverbose (bool) –
-v / --verbosenon_interactive (bool) –
-y / --noninteractive, defaults to Truecolor (HgColorTypeLiteral) –
--colordebug (bool) –
--debugdebugger (bool) –
--debuggerencoding (str) –
--encoding ENCODEencoding_mode (str) –
--encodingmode MODEtraceback (bool) –
--tracebacktime (bool) –
--timeprofile (bool) –
--profileversion (bool) –
--version_help (bool) –
-h / --helphidden (bool) –
--hiddenpager (HgPagerType) –
--pager TYPEconfig (str | None) –
--config CONFIG [+],section.name=valuecheck_returncode (bool, default: True) – Passthrough to
libvcs._internal.run.run()args (_CMD)
kwargs (Any)
- Return type:
Examples
>>> hg = Hg(path=tmp_path) >>> hg.run(['help']) "Mercurial Distributed SCM..."
Clone a working copy from a mercurial repo.
Wraps hg clone.
Examples
>>> hg = Hg(path=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.path.exists() True
Update working directory.
Wraps hg update.
Examples
>>> hg = Hg(path=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'
Update working directory.
Wraps hg pull.
Examples
>>> hg = Hg(path=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'