1. Scott Lawrence (Oz Linden)
  2. tools

Overview

HTTPS SSH

This is a repository of tools I use in the course of my day.

Mercurial Utilities

Pulling / Merging

mm-getfix [repository] [ {-i|--issue} *issue* ] [ [{-r|--rev}] *changeset* ]

Looks for changes to be pulled from the specified repository and changeset. If no repository is specified, the current system paste buffer value is used as the repository name.

If there are uncommitted local changes, the operation is aborted.

The changesets that would be pulled are displayed, and then you are prompted for whether or not to proceed to pull them.

If the pull creates a new head, that head is merged to the previous tip. If that merge does not complete successfully (not all conflicts were resolved), you are prompted for whether or not to discard the pulled changesets. If the merge does complete successfully, you are prompted for a merge comment (the default is "merge changes for issue; the issue value defaults to the last pair of tokens in the respository name if they look like a Jira issue id).

kdiff3-wrapper

Provides for better labels on the input versions in a three way merge; the common ancestor is labeled ANCESTOR and the other two versions are labeled with the repository names.

This relies on this configuration in your global hg rc file: [merge-tools] kdiff3.executable = kdiff3-wrapper kdiff3.args = --auto $base $local $other -o $output kdiff3.priority = 1

[merge-patterns]
* = kdiff3

merging the tags file

Manually merging the .hgtags file in a repository can be a pain; this configuration automates it:

[merge-tools]
hgtags.executable = hg
hgtags.args = log -r "tagged()" --style ~/_config/hg/tag-merge.style > $output
hgtags.premerge = False

[merge-patterns]
.hgtags = hgtags

Where the tag-merge.style file contains: changeset = "{tags}" tag = "{node} {tag}\n"

Pushing

mm-push [{-n|--dry-run}] [{-r|--rev} <changeset>] [ <target-repo> ]

A wrapper for 'hg push' that provides some additional checks and confirmation. If no target-repo is provided, the usual hg behavior is used (the default-push or default repo).

  • Checks for any uncommitted local changes; if there are local uncommitted changes, asks for confirmation to proceed
  • Translates any alias used for target-repo.
  • Checks to see if there are unmerged changes in the target-repo; if there are remote changes, displays them in 'compact' format and aborts.
  • Checks to see if there any local changes to be pushed (up to the specified revision, if specified); if there are local changes, displays them in 'compact' format and requests confirmation before pushing them.

With --dry-run, the tests are performed, and the changesets that would have been pushed are displayed, but no actual push is executed.

Repository Comparison

hg-compare [<verbosity-option>] [ {-i|--in} | {-o|--out} [ <repository1> [ <repositoryN> ] ... ]

repository

Is either a remote repository URL or a local repository path. If no repository is specified, the system paste buffer is used.

Each repository is compared to the current repository: the number of changesets that would be moved by a pull or push are displayed (in verbose mode a summary log for each is shown).

With --in or --out options only one direction is displayed.