# HG changeset patch # User Vadim Gelfer # Date 1140108684 28800 # Node ID d3e6da334b8570cc90b8926c63d242ff35577856 # Parent 019e6a47a53ebd3574d0398696693f7521f02881# Parent 251729df9cc6f689c6ba3bd3fc94631506edeceb merge with crew. diff --git a/doc/hgrc.5.txt b/doc/hgrc.5.txt --- a/doc/hgrc.5.txt +++ b/doc/hgrc.5.txt @@ -145,30 +145,34 @@ hooks:: incoming.email = /my/email/hook incoming.autobuild = /my/build/hook + Most hooks are run with environment variables set that give added + useful information. For each hook below, the environment variables + it is passed are listed with names of the form "$HG_foo". + changegroup;; Run after a changegroup has been added via push, pull or - unbundle. Passed the ID of the first new changeset in $NODE. + unbundle. ID of the first new changeset is in $HG_NODE. commit;; Run after a changeset has been created in the local repository. - Passed the ID of the newly created changeset in environment - variable $NODE. Parent changeset IDs in $P1 and $P2. + ID of the newly created changeset is in $HG_NODE. Parent + changeset IDs are in $HG_PARENT1 and $HG_PARENT2. incoming;; Run after a changeset has been pulled, pushed, or unbundled into - the local repository. Passed the ID of the newly arrived - changeset in environment variable $NODE. + the local repository. The ID of the newly arrived changeset is in + $HG_NODE. prechangegroup;; Run before a changegroup is added via push, pull or unbundle. Exit status 0 allows the changegroup to proceed. Non-zero status will cause the push, pull or unbundle to fail. precommit;; Run before starting a local commit. Exit status 0 allows the - commit to proceed. Non-zero status will cause the commit to - fail. Parent changeset IDs in $P1 and $P2. + commit to proceed. Non-zero status will cause the commit to fail. + Parent changeset IDs are in $HG_PARENT1 and $HG_PARENT2. pretag;; Run before creating a tag. Exit status 0 allows the tag to be created. Non-zero status will cause the tag to fail. ID of - changeset to tag in $NODE. Name of tag in $TAG. Tag is local if - $LOCAL=1, in repo if $LOCAL=0. + changeset to tag is in $HG_NODE. Name of tag is in $HG_TAG. Tag + is local if $HG_LOCAL=1, in repo if $HG_LOCAL=0. pretxnchangegroup;; Run after a changegroup has been added via push, pull or unbundle, but before the transaction has been committed. Changegroup is @@ -182,12 +186,17 @@ hooks:: committed. Changeset is visible to hook program. This lets you validate commit message and changes. Exit status 0 allows the commit to proceed. Non-zero status will cause the transaction to - be rolled back. ID of changeset in $NODE. Parent changeset IDs - in $P1 and $P2. + be rolled back. ID of changeset is in $HG_NODE. Parent changeset + IDs are in $HG_PARENT1 and $HG_PARENT2. tag;; - Run after a tag is created. ID of tagged changeset in $NODE. - Name of tag in $TAG. Tag is local if $LOCAL=1, in repo if - $LOCAL=0. + Run after a tag is created. ID of tagged changeset is in + $HG_NODE. Name of tag is in $HG_TAG. Tag is local if + $HG_LOCAL=1, in repo if $HG_LOCAL=0. + + In earlier releases, the names of hook environment variables did not + have a "HG_" prefix. These unprefixed names are still provided in + the environment for backwards compatibility, but their use is + deprecated, and they will be removed in a future release. http_proxy:: Used to access web-based Mercurial repositories through a HTTP diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1681,7 +1681,7 @@ def outgoing(ui, repo, dest="default-pus dodiff(ui, ui, repo, prev, n) ui.write("\n") -def parents(ui, repo, rev=None): +def parents(ui, repo, rev=None, branch=None): """show the parents of the working dir or revision Print the working directory's parent revisions. @@ -1691,9 +1691,12 @@ def parents(ui, repo, rev=None): else: p = repo.dirstate.parents() + br = None + if branch is not None: + br = repo.branchlookup(p) for n in p: if n != nullid: - show_changeset(ui, repo, changenode=n) + show_changeset(ui, repo, changenode=n, brinfo=br) def paths(ui, search=None): """show definition of symbolic path names @@ -2419,7 +2422,10 @@ table = { ('p', 'patch', None, _('show patch')), ('n', 'newest-first', None, _('show newest record first'))], _('hg outgoing [-p] [-n] [-M] [DEST]')), - "^parents": (parents, [], _('hg parents [REV]')), + "^parents": + (parents, + [('b', 'branch', None, _('show branches'))], + _('hg parents [-b] [REV]')), "paths": (paths, [], _('hg paths [NAME]')), "^pull": (pull, diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -54,7 +54,9 @@ class localrepository(object): old = {} for k, v in args.items(): k = k.upper() + old['HG_' + k] = os.environ.get(k, None) old[k] = os.environ.get(k, None) + os.environ['HG_' + k] = str(v) os.environ[k] = str(v) try: @@ -64,7 +66,7 @@ class localrepository(object): r = os.system(cmd) finally: for k, v in old.items(): - if v != None: + if v is not None: os.environ[k] = v else: del os.environ[k] @@ -380,7 +382,7 @@ class localrepository(object): if p2 == nullid: xp2 = '' else: xp2 = hex(p2) - self.hook("precommit", throw=True, p1=xp1, p2=xp2) + self.hook("precommit", throw=True, parent1=xp1, parent2=xp2) if not wlock: wlock = self.wlock() @@ -466,14 +468,15 @@ class localrepository(object): user = user or self.ui.username() n = self.changelog.add(mn, changed + remove, text, tr, p1, p2, user, date) - self.hook('pretxncommit', throw=True, node=hex(n), p1=xp1, p2=xp2) + self.hook('pretxncommit', throw=True, node=hex(n), parent1=xp1, + parent2=xp2) tr.close() self.dirstate.setparents(n) self.dirstate.update(new, "n") self.dirstate.forget(remove) - self.hook("commit", node=hex(n), p1=xp1, p2=xp2) + self.hook("commit", node=hex(n), parent1=xp1, parent2=xp2) return n def walk(self, node=None, files=[], match=util.always):