HG(1) Mercurial Manual HG(1) NAME hg - Mercurial source code management system SYNOPSIS hg command [option]... [argument]... DESCRIPTION The hg command provides a command line interface to the Mercurial system. COMMAND ELEMENTS files... indicates one or more filename or relative path filenames; see File Name Patterns for information on pattern matching path indicates a path on the local machine revision indicates a changeset which can be specified as a changeset revision number, a tag, or a unique substring of the changeset hash value repository path either the pathname of a local repository or the URI of a remote repository. OPTIONS -R,--repository repository root directory or name of overlay bundle file --cwd change working directory -y, --noninteractive do not prompt, automatically pick the first choice for all prompts -q, --quiet suppress output -v, --verbose enable additional output --color when to colorize (boolean, always, auto, never, or debug) --config set/override config option (use 'section.name=value') --debug enable debugging output --debugger start debugger --encoding set the charset encoding (default: UTF-8) --encodingmode set the charset encoding mode (default: strict) --traceback always print a traceback on exception --time time how long the command takes --profile print command execution profile --version output version information and exit -h, --help display help and exit --hidden consider hidden changesets --pager when to paginate (boolean, always, auto, or never) (default: auto) [+] marked option can be specified multiple times COMMANDS Repository creation clone make a copy of an existing repository: hg clone [OPTION]... SOURCE [DEST] Create a copy of an existing repository in a new directory. If no destination directory name is specified, it defaults to the basename of the source. The location of the source is added to the new repository's .hg/hgrc file, as the default to be used for future pulls. Only local paths and ssh:// URLs are supported as destinations. For ssh:// destinations, no working directory or .hg/hgrc will be created on the remote side. If the source repository has a bookmark called '@' set, that revision will be checked out in the new repository by default. To check out a particular version, use -u/--update, or -U/--noupdate to create a clone with no working directory. To pull only a subset of changesets, specify one or more revisions identifiers with -r/--rev or branches with -b/--branch. The resulting clone will contain only the specified changesets and their ancestors. These options (or 'clone src#rev dest') imply --pull, even for local source repositories. In normal clone mode, the remote normalizes repository data into a common exchange format and the receiving end translates this data into its local storage format. --stream activates a different clone mode that essentially copies repository files from the remote with minimal data processing. This significantly reduces the CPU cost of a clone both remotely and locally. However, it often increases the transferred data size by 30-40%. This can result in substantially faster clones where I/O throughput is plentiful, especially for larger repositories. A side-effect of --stream clones is that storage settings and requirements on the remote are applied locally: a modern client may inherit legacy or inefficient storage used by the remote or a legacy Mercurial client may not be able to clone from a modern Mercurial remote. Note Specifying a tag will include the tagged changeset but not the changeset containing the tag. For efficiency, hardlinks are used for cloning whenever the source and destination are on the same filesystem (note this applies only to the repository data, not to the working directory). Some filesystems, such as AFS, implement hardlinking incorrectly, but do not report errors. In these cases, use the --pull option to avoid hardlinking. Mercurial will update the working directory to the first applicable revision from this list: a. null if -U or the source repository has no changesets b. if -u . and the source repository is local, the first parent of the source repository's working directory c. the changeset specified with -u (if a branch name, this means the latest head of that branch) d. the changeset specified with -r e. the tipmost head specified with -b f. the tipmost head specified with the url#branch source syntax g. the revision marked with the '@' bookmark, if present h. the tipmost head of the default branch i. tip When cloning from servers that support it, Mercurial may fetch pre-generated data from a server-advertised URL or inline from the same stream. When this is done, hooks operating on incoming changesets and changegroups may fire more than once, once for each pre-generated bundle and as well as for any additional remaining data. In addition, if an error occurs, the repository may be rolled back to a partial clone. This behavior may change in future releases. See hg help -e clonebundles for more. Examples: o clone a remote repository to a new directory named hg/: hg clone https://www.mercurial-scm.org/repo/hg/ o create a lightweight local clone: hg clone project/ project-feature/ o clone from an absolute path on an ssh server (note double-slash): hg clone ssh://user@server//home/projects/alpha/ o do a streaming clone while checking out a specified version: hg clone --stream http://server/repo -u 1.5 o create a repository without changesets after a particular revision: hg clone -r 04e544 experimental/ good/ o clone (and track) a particular named branch: hg clone https://www.mercurial-scm.org/repo/hg/#stable See hg help urls for details on specifying URLs. Returns 0 on success. Options: -U, --noupdate the clone will include an empty working directory (only a repository) -u,--updaterev revision, tag, or branch to check out -r,--rev do not clone everything, but include this changeset and its ancestors -b,--branch do not clone everything, but include this branch's changesets and their ancestors --pull use pull protocol to copy metadata --uncompressed an alias to --stream (DEPRECATED) --stream clone with minimal data processing -e,--ssh specify ssh command to use --remotecmd specify hg command to run on the remote side --insecure do not verify server certificate (ignoring web.cacerts config) [+] marked option can be specified multiple times init create a new repository in the given directory: hg init [-e CMD] [--remotecmd CMD] [DEST] Initialize a new repository in the given directory. If the given directory does not exist, it will be created. If no directory is given, the current directory is used. It is possible to specify an ssh:// URL as the destination. See hg help urls for more information. Returns 0 on success. Options: -e,--ssh specify ssh command to use --remotecmd specify hg command to run on the remote side --insecure do not verify server certificate (ignoring web.cacerts config) Remote repository management incoming show new changesets found in source: hg incoming [-p] [-n] [-M] [-f] [-r REV]... [--bundle FILENAME] [SOURCE] Show new changesets found in the specified path/URL or the default pull location. These are the changesets that would have been pulled by hg pull at the time you issued this command. See pull for valid source format details. With -B/--bookmarks, the result of bookmark comparison between local and remote repositories is displayed. With -v/--verbose, status is also displayed for each bookmark like below: BM1 01234567890a added BM2 1234567890ab advanced BM3 234567890abc diverged BM4 34567890abcd changed The action taken locally when pulling depends on the status of each bookmark: added pull will create it advanced pull will update it diverged pull will create a divergent bookmark changed result depends on remote changesets From the point of view of pulling behavior, bookmark existing only in the remote repository are treated as added, even if it is in fact locally deleted. For remote repository, using --bundle avoids downloading the changesets twice if the incoming is followed by a pull. Examples: o show incoming changes with patches and full description: hg incoming -vp o show incoming changes excluding merges, store a bundle: hg in -vpM --bundle incoming.hg hg pull incoming.hg o briefly list changes inside a bundle: hg in changes.hg -T "{desc|firstline}\n" Returns 0 if there are incoming changes, 1 otherwise. Options: -f, --force run even if remote repository is unrelated -n, --newest-first show newest record first --bundle file to store the bundles into -r,--rev a remote changeset intended to be added -B, --bookmarks compare bookmarks -b,--branch a specific branch you would like to pull -p, --patch show patch -g, --git use git extended diff format -l,--limit limit number of changes displayed -M, --no-merges do not show merges --stat output diffstat-style summary of changes -G, --graph show the revision DAG --style