Submitter | Angel Ezquerra |
---|---|
Date | May 10, 2014, 11:38 p.m. |
Message ID | <6860a9cad193936489dc.1399765116@Angel-PC.localdomain> |
Download | mbox | patch |
Permalink | /patch/4724/ |
State | Accepted |
Headers | show |
Comments
On 05/10/2014 04:38 PM, Angel Ezquerra wrote: > # HG changeset patch > # User Angel Ezquerra <angel.ezquerra@gmail.com> > # Date 1399414642 -7200 > # Wed May 07 00:17:22 2014 +0200 > # Node ID 6860a9cad193936489dcb0ddf0c9db5867545222 > # Parent e2a1cd702ae0871c5d3269bedb82db857804d316 > subrepo: add revdetails() method > > This method is able to show the "revision details" for a given revision. > Currently for mercurial subrepos it returns a string which resembles a lot what > the default template writes to the console when doing hg log. For all other > types of subrepos we just return the revision id as a string. > > We could not use the templater to get this info because the templater writes to > the console (i.e. it does not return a string that we can use). I believe this paragraph is outdated > > This method will be used on the next revision. > > diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py > --- a/mercurial/subrepo.py > +++ b/mercurial/subrepo.py > @@ -505,6 +505,9 @@ > def shortid(self, revid): > return revid > > + def revdetails(self, revid): This function could use a small docstring about its goal, role and usage. > + return 'changeset: %s' % str(revid) > + > class hgsubrepo(abstractsubrepo): > def __init__(self, ctx, path, state): > self._path = path > @@ -873,6 +876,15 @@ > def shortid(self, revid): > return revid[:12] > > + @annotatesubrepoerror > + def revdetails(self, revid): Same here.
On 05/10/2014 04:38 PM, Angel Ezquerra wrote: > # HG changeset patch > # User Angel Ezquerra <angel.ezquerra@gmail.com> > # Date 1399414642 -7200 > # Wed May 07 00:17:22 2014 +0200 > # Node ID 6860a9cad193936489dcb0ddf0c9db5867545222 > # Parent e2a1cd702ae0871c5d3269bedb82db857804d316 > subrepo: add revdetails() method This changeset and its parent have been unclowncopterized 00:59 < mpm> This is step in the wrong direction for my long-term merge strategy.. which is that we allow deferring tricky merge questions by sticking them in the resolve list.
Patch
diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -505,6 +505,9 @@ def shortid(self, revid): return revid + def revdetails(self, revid): + return 'changeset: %s' % str(revid) + class hgsubrepo(abstractsubrepo): def __init__(self, ctx, path, state): self._path = path @@ -873,6 +876,15 @@ def shortid(self, revid): return revid[:12] + @annotatesubrepoerror + def revdetails(self, revid): + ctx = self._repo[revid] + self._repo.ui.pushbuffer() + printer = cmdutil.changeset_printer( + self._repo.ui, self._repo, None, {}, False) + printer.show(ctx) + return self._repo.ui.popbuffer().strip() + class svnsubrepo(abstractsubrepo): def __init__(self, ctx, path, state): self._path = path