Mercurial > hg > hq
comparison hq/main.py @ 13:42a1de8a0bd5
remove obselete code
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Thu, 09 May 2013 15:07:36 -0700 |
parents | 92484d1db1b2 |
children | 46a68cd554b5 |
comparison
equal
deleted
inserted
replaced
12:92484d1db1b2 | 13:42a1de8a0bd5 |
---|---|
31 # repository root | 31 # repository root |
32 self.root = root or call(['hg', 'root']).strip() | 32 self.root = root or call(['hg', 'root']).strip() |
33 | 33 |
34 # hg binary | 34 # hg binary |
35 self.binary = binary | 35 self.binary = binary |
36 | |
37 # patch repo; not guaranteed to exit | |
38 self._patch_repo = self.os.path.join(self.root, '.hg', 'patches') | |
36 | 39 |
37 ### subcommands | 40 ### subcommands |
38 | 41 |
39 def clone(self, repo, patch=None, queue=None): | 42 def clone(self, repo, patch=None, queue=None): |
40 """ | 43 """ |
108 # Alternatively, you can allow any short non-ambiguous abbreviation. | 111 # Alternatively, you can allow any short non-ambiguous abbreviation. |
109 | 112 |
110 return '\n'.join([self._call(i).strip() for i in ('root', 'status', 'qseries')]) | 113 return '\n'.join([self._call(i).strip() for i in ('root', 'status', 'qseries')]) |
111 | 114 |
112 def directory(self): | 115 def directory(self): |
113 """ | 116 """patch queue directory""" |
114 patch queue directory | 117 if os.path.isdir(self._patch_repo): |
115 """ | 118 return self._patch_repo |
116 patch_dir = os.path.join(self.root, '.hg', 'patches') | |
117 return patch_dir if os.path.isdir(patch_dir) else None | |
118 | 119 |
119 ### internals | 120 ### internals |
120 | 121 |
121 def _call(self, *args): | 122 def _call(self, *args): |
122 command = [self.binary] + list(args) | 123 command = [self.binary] + list(args) |
123 return call(command, cwd=self.root) | 124 return call(command, cwd=self.root) |
124 | |
125 def _patch_repo(self): | |
126 """the location of the patch repository""" | |
127 root = subprocess.Popen(['hg', 'root'], stdout=subprocess.PIPE).communicate()[0] | |
128 return os.path.join(root, '.hg', 'patches') | |
129 | 125 |
130 def _patch_command(self, *command): | 126 def _patch_command(self, *command): |
131 """perform a command in the patch repository""" | 127 """perform a command in the patch repository""" |
132 call(command, cwd=self.directory()) | 128 call(command, cwd=self.directory()) |
133 | 129 |