changeset 1732:d3e6da334b85

merge with crew.
author Vadim Gelfer <vadim.gelfer@gmail.com>
date Thu, 16 Feb 2006 08:51:24 -0800
parents 019e6a47a53e (diff) 251729df9cc6 (current diff)
children 6d288d8c3ca6
files doc/hgrc.5.txt mercurial/commands.py mercurial/localrepo.py
diffstat 3 files changed, 39 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/doc/hgrc.5.txt	Wed Feb 15 11:05:43 2006 -0800
+++ b/doc/hgrc.5.txt	Thu Feb 16 08:51:24 2006 -0800
@@ -145,30 +145,34 @@
     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 @@
     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
--- a/mercurial/commands.py	Wed Feb 15 11:05:43 2006 -0800
+++ b/mercurial/commands.py	Thu Feb 16 08:51:24 2006 -0800
@@ -1681,7 +1681,7 @@
             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 @@
     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 @@
           ('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,
--- a/mercurial/localrepo.py	Wed Feb 15 11:05:43 2006 -0800
+++ b/mercurial/localrepo.py	Thu Feb 16 08:51:24 2006 -0800
@@ -54,7 +54,9 @@
             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 @@
                 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 @@
         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 @@
 
         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):