def parent_rev(self): if self.parent: return self.parent rev = self.rev if self.rev == 'WORK': rev = 'tip' cmd = ['hg', 'log', '-r', rev, '--template', '{node|short}'] self.parent = get_command_output(cmd) return self.parent
def get_abs_rev(self, repo, rev): if str(rev).upper() == 'WORK': return 'WORK' cmd = ['hg', 'id', '-ir', str(rev).lower(), repo] cmd_string = ' '.join(cmd) if cmd_string in ABS_REV_CACHE: return ABS_REV_CACHE[cmd_string] abs_rev = get_command_output(cmd) if not abs_rev: logging.error('Revision %s not present in repo %s' % (rev, repo)) sys.exit(1) ABS_REV_CACHE[cmd_string] = abs_rev return abs_rev