Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/subrepo.py @ 21400:78a60daacea8
subrepo: add shortid() method to subrepo classes
This method takes an "id" (e.g. a revision id) and returns a "short" version
(e.g. a short revision id).
This will be used on the next revision to fix a small bug in the way that the
text on the promptchoice shown when a subrepo diverges is generated.
author | Angel Ezquerra <angel.ezquerra@gmail.com> |
---|---|
date | Wed, 07 May 2014 00:08:20 +0200 |
parents | a2cc3c08c3ac |
children | 2c364f7801c8 |
comparison
equal
deleted
inserted
replaced
21399:3b6b1b407e99 | 21400:78a60daacea8 |
---|---|
499 def revert(self, ui, substate, *pats, **opts): | 499 def revert(self, ui, substate, *pats, **opts): |
500 ui.warn('%s: reverting %s subrepos is unsupported\n' \ | 500 ui.warn('%s: reverting %s subrepos is unsupported\n' \ |
501 % (substate[0], substate[2])) | 501 % (substate[0], substate[2])) |
502 return [] | 502 return [] |
503 | 503 |
504 def shortid(self, revid): | |
505 return revid | |
506 | |
504 class hgsubrepo(abstractsubrepo): | 507 class hgsubrepo(abstractsubrepo): |
505 def __init__(self, ctx, path, state): | 508 def __init__(self, ctx, path, state): |
506 self._path = path | 509 self._path = path |
507 self._state = state | 510 self._state = state |
508 r = ctx._repo | 511 r = ctx._repo |
863 if opts.get('all'): | 866 if opts.get('all'): |
864 pats = ['set:modified()'] | 867 pats = ['set:modified()'] |
865 else: | 868 else: |
866 pats = [] | 869 pats = [] |
867 cmdutil.revert(ui, self._repo, ctx, parents, *pats, **opts) | 870 cmdutil.revert(ui, self._repo, ctx, parents, *pats, **opts) |
871 | |
872 def shortid(self, revid): | |
873 return revid[:12] | |
868 | 874 |
869 class svnsubrepo(abstractsubrepo): | 875 class svnsubrepo(abstractsubrepo): |
870 def __init__(self, ctx, path, state): | 876 def __init__(self, ctx, path, state): |
871 self._path = path | 877 self._path = path |
872 self._state = state | 878 self._state = state |
1559 removed.append(f) | 1565 removed.append(f) |
1560 | 1566 |
1561 deleted = unknown = ignored = clean = [] | 1567 deleted = unknown = ignored = clean = [] |
1562 return modified, added, removed, deleted, unknown, ignored, clean | 1568 return modified, added, removed, deleted, unknown, ignored, clean |
1563 | 1569 |
1570 def shortid(self, revid): | |
1571 return revid[:7] | |
1572 | |
1564 types = { | 1573 types = { |
1565 'hg': hgsubrepo, | 1574 'hg': hgsubrepo, |
1566 'svn': svnsubrepo, | 1575 'svn': svnsubrepo, |
1567 'git': gitsubrepo, | 1576 'git': gitsubrepo, |
1568 } | 1577 } |