# HG changeset patch # User Jeff Hammel # Date 1306788591 25200 # Node ID 60ddc49acd5fca3747ade1ea9f6a2db8a47ef07d # Parent d3b1bf9d8235ff90fa00cc3eaca122f266d070f1 add partial checkout method to hg diff -r d3b1bf9d8235 -r 60ddc49acd5f buttercup/source.py --- 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):