changeset 556:12747ea5e6a5

Added `hg:pull` command (see #303)
author dfraser
date Mon, 11 May 2009 09:19:42 +0000
parents fe4293ddf51c
children b4d3d9cbf200
files bitten/build/hgtools.py setup.py
diffstat 2 files changed, 29 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
new file mode 100644
--- /dev/null
+++ b/bitten/build/hgtools.py
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+
+"""Recipe commands for Mercurial."""
+
+import logging
+
+log = logging.getLogger('bitten.build.hgtools')
+
+__docformat__ = 'restructuredtext en'
+
+def pull(ctxt, revision=None, dir_='.'):
+    """pull and update the local working copy from the Mercurial repository.
+    
+    :param ctxt: the build context
+    :type ctxt: `Context`
+    :param revision: the revision to check out
+    :param dir_: the name of a local subdirectory containing the working copy
+    """
+    args = ['pull', '-u']
+    if revision:
+        args += ['-r', revision.split(':')[0]]
+    args += [dir_]
+
+    from bitten.build import shtools
+    returncode = shtools.execute(ctxt, file_='hg', args=args)
+    if returncode != 0:
+        ctxt.error('hg pull -u failed (%s)' % returncode)
+
--- a/setup.py
+++ b/setup.py
@@ -88,6 +88,7 @@
             NS + 'svn#checkout = bitten.build.svntools:checkout',
             NS + 'svn#export = bitten.build.svntools:export',
             NS + 'svn#update = bitten.build.svntools:update',
+            NS + 'hg#pull = bitten.build.hgtools:pull',
             NS + 'xml#transform = bitten.build.xmltools:transform'
         ]
     },
Copyright (C) 2012-2017 Edgewall Software