Mercurial > hg > buttercup
changeset 20:60ddc49acd5f
add partial checkout method to hg
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Mon, 30 May 2011 13:49:51 -0700 |
parents | d3b1bf9d8235 |
children | 1f54294629f9 |
files | buttercup/source.py |
diffstat | 1 files changed, 10 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/buttercup/source.py Mon May 30 13:41:14 2011 -0700 +++ b/buttercup/source.py Mon May 30 13:49:51 2011 -0700 @@ -1,5 +1,8 @@ import os -import subprocess +try: + from subprocess import check_call as call +except: + from subprocess import call class Source(object): """abstract base class for VCS source""" @@ -20,6 +23,12 @@ def update(self): """updates a checkout or does one if it does not exist""" + if os.path.exists(self.directory()): + assert os.path.exists(os.path.join(self.directory(), '.hg')) + call(['hg', 'pull'], cwd=self.directory) + call(['hg', 'update'], cwd=self.directory) + else: + pass class GitSource(Source):