def _getlog(self, ctx): if ctx.rev() is None: if self.unicodestar: # The Unicode symbol is a black star: return u'\u2605 ' + _('Working Directory') + u' \u2605' else: return '*** ' + _('Working Directory') + ' ***' if self.repo.ui.configbool('tortoisehg', 'longsummary'): limit = 0x7fffffff # unlimited (elide it by view) else: limit = None # first line return hglib.longsummary(ctx.description(), limit)
def preset_func(widget, item, ctx): if item == 'rev': revnum = self.get_data('revnum', *args) revid = self.get_data('revid', *args) if revid: return (revnum, revid) return None elif item == 'revnum': return ctx.rev() elif item == 'revid': return str(ctx) elif item == 'desc': return hglib.tounicode(ctx.description().replace('\0', '')) elif item == 'summary': summary = hglib.longsummary( ctx.description().replace('\0', '')) if len(summary) == 0: return None return summary elif item == 'user': user = hglib.user(ctx) if user: return hglib.tounicode(user) return None elif item == 'shortuser': return hglib.tounicode(hglib.username(hglib.user(ctx))) elif item == 'dateage': date = self.get_data('date', *args) age = self.get_data('age', *args) if date and age: return (date, age) return None elif item == 'date': date = ctx.date() if date: return hglib.displaytime(date) return None elif item == 'age': date = ctx.date() if date: return hglib.age(date).decode('utf-8') return None elif item == 'rawbranch': return ctx.branch() or None elif item == 'branch': value = self.get_data('rawbranch', *args) if value: repo = ctx._repo try: if ctx.node() != repo.branchtip(ctx.branch()): return None except error.RepoLookupError: # ctx.branch() can be invalid for null or workingctx return None if value in repo.deadbranches: return None return value return None elif item == 'close': return ctx.extra().get('close') elif item == 'tags': return ctx.thgtags() or None elif item == 'graft': extra = ctx.extra() try: return extra['source'] except KeyError: pass return None elif item == 'transplant': extra = ctx.extra() try: ts = extra['transplant_source'] if ts: return binascii.hexlify(ts) except KeyError: pass return None elif item == 'obsolete': obsoletestate = [] if ctx.obsolete(): obsoletestate.append('obsolete') if ctx.extinct(): obsoletestate.append('extinct') obsoletestate += ctx.troubles() if obsoletestate: return obsoletestate return None elif item == 'p4': extra = ctx.extra() p4cl = extra.get('p4', None) return p4cl and ('changelist %s' % p4cl) elif item == 'svn': extra = ctx.extra() cvt = extra.get('convert_revision', '') if cvt.startswith('svn:'): result = cvt.split('/', 1)[-1] if cvt != result: return result return cvt.split('@')[-1] else: return None elif item == 'converted': extra = ctx.extra() cvt = extra.get('convert_revision', '') if cvt and not cvt.startswith('svn:'): return cvt else: return None elif item == 'ishead': childbranches = [cctx.branch() for cctx in ctx.children()] return ctx.branch() not in childbranches elif item == 'mqoriginalparent': target = ctx.thgmqoriginalparent() if not target: return None p1 = ctx.p1() if p1 is not None and p1.hex() == target: return None if target not in ctx._repo: return None return target raise UnknownItem(item)
def longsummary(self): if self._repo.ui.configbool('tortoisehg', 'longsummary'): limit = 80 else: limit = None return hglib.longsummary(self.description(), limit)
def preset_func(widget, item, ctx): if item == "rev": revnum = self.get_data("revnum", *args) revid = self.get_data("revid", *args) if revid: return (revnum, revid) return None elif item == "revnum": return ctx.rev() elif item == "revid": return str(ctx) elif item == "desc": return hglib.tounicode(ctx.description().replace("\0", "")) elif item == "summary": summary = hglib.longsummary(ctx.description().replace("\0", "")) if len(summary) == 0: return None return summary elif item == "user": user = hglib.user(ctx) if user: return hglib.tounicode(user) return None elif item == "shortuser": return hglib.tounicode(hglib.username(hglib.user(ctx))) elif item == "dateage": date = self.get_data("date", *args) age = self.get_data("age", *args) if date and age: return (date, age) return None elif item == "date": date = ctx.date() if date: return hglib.displaytime(date) return None elif item == "age": date = ctx.date() if date: return hglib.age(date).decode("utf-8") return None elif item == "rawbranch": return ctx.branch() or None elif item == "branch": value = self.get_data("rawbranch", *args) if value: repo = ctx._repo if ctx.node() not in repo.branchtags().values(): return None if value in repo.deadbranches: return None return value return None elif item == "close": return ctx.extra().get("close") elif item == "rawtags": return hglib.getrawctxtags(ctx) elif item == "tags": return hglib.getctxtags(ctx) elif item == "graft": extra = ctx.extra() try: return extra["source"] except KeyError: pass return None elif item == "transplant": extra = ctx.extra() try: ts = extra["transplant_source"] if ts: return binascii.hexlify(ts) except KeyError: pass return None elif item == "obsolete": obsoletestate = [] if ctx.obsolete(): obsoletestate.append("obsolete") if ctx.extinct(): obsoletestate.append("extinct") obsoletestate += ctx.troubles() if obsoletestate: return obsoletestate return None elif item == "p4": extra = ctx.extra() p4cl = extra.get("p4", None) return p4cl and ("changelist %s" % p4cl) elif item == "svn": extra = ctx.extra() cvt = extra.get("convert_revision", "") if cvt.startswith("svn:"): result = cvt.split("/", 1)[-1] if cvt != result: return result return cvt.split("@")[-1] else: return None elif item == "converted": extra = ctx.extra() cvt = extra.get("convert_revision", "") if cvt and not cvt.startswith("svn:"): return cvt else: return None elif item == "ishead": childbranches = [cctx.branch() for cctx in ctx.children()] return ctx.branch() not in childbranches raise UnknownItem(item)
def summary_line(desc): return hglib.longsummary(desc.replace('\0', ''))
def preset_func(widget, item, ctx): if item == 'rev': revnum = self.get_data('revnum', *args) revid = self.get_data('revid', *args) if revid: return (revnum, revid) return None elif item == 'revnum': return ctx.rev() elif item == 'revid': return str(ctx) elif item == 'desc': return hglib.tounicode(ctx.description().replace('\0', '')) elif item == 'summary': summary = hglib.longsummary(ctx.description().replace( '\0', '')) if len(summary) == 0: return None return summary elif item == 'user': user = hglib.user(ctx) if user: return hglib.tounicode(user) return None elif item == 'shortuser': return hglib.tounicode(hglib.username(hglib.user(ctx))) elif item == 'dateage': date = self.get_data('date', *args) age = self.get_data('age', *args) if date and age: return (date, age) return None elif item == 'date': date = ctx.date() if date: return hglib.displaytime(date) return None elif item == 'age': date = ctx.date() if date: return hglib.age(date).decode('utf-8') return None elif item == 'rawbranch': return ctx.branch() or None elif item == 'branch': value = self.get_data('rawbranch', *args) if value: repo = ctx._repo if ctx.node() not in repo.branchtags().values(): return None if value in repo.deadbranches: return None return value return None elif item == 'close': return ctx.extra().get('close') elif item == 'rawtags': return hglib.getrawctxtags(ctx) elif item == 'tags': return hglib.getctxtags(ctx) elif item == 'graft': extra = ctx.extra() try: return extra['source'] except KeyError: pass return None elif item == 'transplant': extra = ctx.extra() try: ts = extra['transplant_source'] if ts: return binascii.hexlify(ts) except KeyError: pass return None elif item == 'obsolete': obsoletestate = [] if ctx.obsolete(): obsoletestate.append('obsolete') if ctx.extinct(): obsoletestate.append('extinct') obsoletestate += ctx.troubles() if obsoletestate: return obsoletestate return None elif item == 'p4': extra = ctx.extra() p4cl = extra.get('p4', None) return p4cl and ('changelist %s' % p4cl) elif item == 'svn': extra = ctx.extra() cvt = extra.get('convert_revision', '') if cvt.startswith('svn:'): result = cvt.split('/', 1)[-1] if cvt != result: return result return cvt.split('@')[-1] else: return None elif item == 'converted': extra = ctx.extra() cvt = extra.get('convert_revision', '') if cvt and not cvt.startswith('svn:'): return cvt else: return None elif item == 'ishead': childbranches = [cctx.branch() for cctx in ctx.children()] return ctx.branch() not in childbranches raise UnknownItem(item)