# HG changeset patch # User Jeff Hammel # Date 1368137256 25200 # Node ID 42a1de8a0bd57e80d1b3ef96fd88cf121cf1f16a # Parent 92484d1db1b24d9458ce994a2c5696dd024854ec remove obselete code diff -r 92484d1db1b2 -r 42a1de8a0bd5 hq/main.py --- a/hq/main.py Thu May 09 15:00:41 2013 -0700 +++ b/hq/main.py Thu May 09 15:07:36 2013 -0700 @@ -34,6 +34,9 @@ # hg binary self.binary = binary + # patch repo; not guaranteed to exit + self._patch_repo = self.os.path.join(self.root, '.hg', 'patches') + ### subcommands def clone(self, repo, patch=None, queue=None): @@ -110,11 +113,9 @@ return '\n'.join([self._call(i).strip() for i in ('root', 'status', 'qseries')]) def directory(self): - """ - patch queue directory - """ - patch_dir = os.path.join(self.root, '.hg', 'patches') - return patch_dir if os.path.isdir(patch_dir) else None + """patch queue directory""" + if os.path.isdir(self._patch_repo): + return self._patch_repo ### internals @@ -122,11 +123,6 @@ command = [self.binary] + list(args) return call(command, cwd=self.root) - def _patch_repo(self): - """the location of the patch repository""" - root = subprocess.Popen(['hg', 'root'], stdout=subprocess.PIPE).communicate()[0] - return os.path.join(root, '.hg', 'patches') - def _patch_command(self, *command): """perform a command in the patch repository""" call(command, cwd=self.directory())