annotate bitten/build/hgtools.py @ 885:f703a0bf6548

Fix `hg:pull` compat with Trac 0.12 as that changes how Mercurial revisions numbers are used. Closes #638. Thanks to krigstask for report and patch.
author osimons
date Fri, 10 Dec 2010 09:33:37 +0000
parents 9b5630fdd35e
children
rev   line source
556
12747ea5e6a5 Added `hg:pull` command (see #303)
dfraser
parents:
diff changeset
1 # -*- coding: utf-8 -*-
12747ea5e6a5 Added `hg:pull` command (see #303)
dfraser
parents:
diff changeset
2
12747ea5e6a5 Added `hg:pull` command (see #303)
dfraser
parents:
diff changeset
3 """Recipe commands for Mercurial."""
12747ea5e6a5 Added `hg:pull` command (see #303)
dfraser
parents:
diff changeset
4
12747ea5e6a5 Added `hg:pull` command (see #303)
dfraser
parents:
diff changeset
5 import logging
12747ea5e6a5 Added `hg:pull` command (see #303)
dfraser
parents:
diff changeset
6
12747ea5e6a5 Added `hg:pull` command (see #303)
dfraser
parents:
diff changeset
7 log = logging.getLogger('bitten.build.hgtools')
12747ea5e6a5 Added `hg:pull` command (see #303)
dfraser
parents:
diff changeset
8
12747ea5e6a5 Added `hg:pull` command (see #303)
dfraser
parents:
diff changeset
9 __docformat__ = 'restructuredtext en'
12747ea5e6a5 Added `hg:pull` command (see #303)
dfraser
parents:
diff changeset
10
12747ea5e6a5 Added `hg:pull` command (see #303)
dfraser
parents:
diff changeset
11 def pull(ctxt, revision=None, dir_='.'):
12747ea5e6a5 Added `hg:pull` command (see #303)
dfraser
parents:
diff changeset
12 """pull and update the local working copy from the Mercurial repository.
12747ea5e6a5 Added `hg:pull` command (see #303)
dfraser
parents:
diff changeset
13
12747ea5e6a5 Added `hg:pull` command (see #303)
dfraser
parents:
diff changeset
14 :param ctxt: the build context
12747ea5e6a5 Added `hg:pull` command (see #303)
dfraser
parents:
diff changeset
15 :type ctxt: `Context`
12747ea5e6a5 Added `hg:pull` command (see #303)
dfraser
parents:
diff changeset
16 :param revision: the revision to check out
677
639e5c466c96 0.6dev: Documentation fixes for all `build_doc` errors and warnings.
osimons
parents: 556
diff changeset
17 :param dir\_: the name of a local subdirectory containing the working copy
556
12747ea5e6a5 Added `hg:pull` command (see #303)
dfraser
parents:
diff changeset
18 """
12747ea5e6a5 Added `hg:pull` command (see #303)
dfraser
parents:
diff changeset
19 args = ['pull', '-u']
12747ea5e6a5 Added `hg:pull` command (see #303)
dfraser
parents:
diff changeset
20 if revision:
885
f703a0bf6548 Fix `hg:pull` compat with Trac 0.12 as that changes how Mercurial revisions numbers are used.
osimons
parents: 731
diff changeset
21 args += ['-r', revision.split(':')[-1]]
556
12747ea5e6a5 Added `hg:pull` command (see #303)
dfraser
parents:
diff changeset
22
12747ea5e6a5 Added `hg:pull` command (see #303)
dfraser
parents:
diff changeset
23 from bitten.build import shtools
729
6b3de00356d1 Changed how `hg:pull` works with disk location - repository directory can't be an argument, instead we need to change the working directory. Closes #530.
osimons
parents: 677
diff changeset
24 returncode = shtools.execute(ctxt, file_='hg', args=args, dir_=dir_)
556
12747ea5e6a5 Added `hg:pull` command (see #303)
dfraser
parents:
diff changeset
25 if returncode != 0:
12747ea5e6a5 Added `hg:pull` command (see #303)
dfraser
parents:
diff changeset
26 ctxt.error('hg pull -u failed (%s)' % returncode)
12747ea5e6a5 Added `hg:pull` command (see #303)
dfraser
parents:
diff changeset
27
Copyright (C) 2012-2017 Edgewall Software