comparison hq/main.py @ 16:b878f4ce93fc

screwed this one up
author Jeff Hammel <jhammel@mozilla.com>
date Fri, 17 May 2013 03:19:28 -0700
parents 6c4f258fae85
children 44ec940c86a6
comparison
equal deleted inserted replaced
15:6c4f258fae85 16:b878f4ce93fc
75 """ 75 """
76 pull from the root repository 76 pull from the root repository
77 if mq is true, update the patch queue, if versioned 77 if mq is true, update the patch queue, if versioned
78 """ 78 """
79 # check for outstanding changes 79 # check for outstanding changes
80 import pdb; pdb.set_trace()
80 output = self._call(['st']).strip() 81 output = self._call(['st']).strip()
81 lines = [line for line in output.splitlines() 82 lines = [line for line in output.splitlines()
82 if not line.startswith('?')] 83 if not line.startswith('?')]
83 if lines: 84 if lines:
84 print "Outstanding changes:" 85 print "Outstanding changes:"
116 def status(self): 117 def status(self):
117 """ 118 """
118 display status 119 display status
119 """ 120 """
120 return '\n'.join([self._call(i).strip() for i in ('root', 'status', 'qseries')]) 121 return '\n'.join([self._call(i).strip() for i in ('root', 'status', 'qseries')])
122 st = status
121 123
122 def directory(self): 124 def directory(self):
123 """patch queue directory""" 125 """patch queue directory"""
124 if os.path.isdir(self._patch_repo): 126 if os.path.isdir(self._patch_repo):
125 return self._patch_repo 127 return self._patch_repo
137 ### internals 139 ### internals
138 140
139 def _call(self, *args, **kwargs): 141 def _call(self, *args, **kwargs):
140 command = [self.binary] + list(args) 142 command = [self.binary] + list(args)
141 kwargs.setdefault('cwd', self.root) 143 kwargs.setdefault('cwd', self.root)
142 return call(command, cwd=self.root) 144 return call(command, **kwargs)
143 145
144 def _patch_command(self, *command, **kwargs): 146 def _patch_command(self, *command, **kwargs):
145 """perform a command in the patch repository""" 147 """perform a command in the patch repository"""
146 kwargs.setdefault(cwd=self.directory()) 148 kwargs.setdefault(cwd=self.directory())
147 return call(command, **kwargs) 149 return call(command)
148 150
149 def _versioned(self): 151 def _versioned(self):
150 """is the patch queue versioned?""" 152 """is the patch queue versioned?"""
151 return os.path.isdir(os.path.join(self.directory(), '.hg')) 153 return os.path.isdir(os.path.join(self.directory(), '.hg'))
152 154