# HG changeset patch # User Jeff Hammel # Date 1274819959 25200 # Node ID 8bc27dbf0214b6c71ca0be0c8ef5bf242b051fa5 # Parent dedf4c4c2ba219a68a02e291f99ff08cd6288294 add stub for goto diff -r dedf4c4c2ba2 -r 8bc27dbf0214 hq/main.py --- a/hq/main.py Tue May 25 10:52:06 2010 -0700 +++ b/hq/main.py Tue May 25 13:39:19 2010 -0700 @@ -28,12 +28,21 @@ # TODO: look at hgrc file # for [defaults] repository_host - def clone(self, repo, patch=None): - """clone the repository and begin a patch queue""" + def clone(self, repo, patch=None, queue=None): + """ + clone the repository and begin a patch queue + - path: name of a new patch to initiate + - queue: name of the remote queue + """ directory = repo.rsplit('/', 1) call(['hg', 'clone', repo, directory]) os.chdir(directory) call(['hg', 'qinit', '-c']) + if queue: + _oldcwd = os.getcwd() + os.chdir(os.path.join('.hg', 'patches')) + call(['hg', 'pull', '--update', queue]) + os.chdir(_oldcwd) if patch: call(['hg', 'qnew', patch]) @@ -62,6 +71,17 @@ call(['hg', 'pull'] + repo and [repo] or []) call(['hg', 'qpush', '--all']) + def goto(self, patch): + """ + goto a specific patch + """ + # TODO + process = subprocess.Popen(['hg', 'qapplied'], stdout=subprocess.PIPE) + stdout, stderr = process.communicate() + applied = [ i.strip() for i in stdout.splitlines() + if i ] + raise NotImplementedError + def files(self): """ list the files added by the top patch