mirror of
https://github.com/facebook/sapling.git
synced 2024-10-12 01:39:21 +03:00
hgsubversion: refactor method for svnrev template keyword to easy wrapping
Summary: This commit is just a simple refactor of the method for the resolving the `svnrev` template keyword. In particular, we split the method so that it can be easily wrapped by other extensions like globalrevs in D16361887. Reviewed By: quark-zju Differential Revision: D16361888 fbshipit-source-id: 9f20fb33afd2b286c4f30571fa257b8284f2bb54
This commit is contained in:
parent
53cc0f0766
commit
0766f36b29
@ -432,9 +432,18 @@ configitem("hgsubversion", "rewritesvncommitwithhghash", default=False)
|
||||
|
||||
|
||||
@templatekeyword("svnrev")
|
||||
def svnrevkw(**args):
|
||||
def svnrevkw(repo, ctx, **kwargs):
|
||||
""":svnrev: String. Converted subversion revision number."""
|
||||
convertinfo = util.getsvnrev(args["ctx"], "")
|
||||
return _svnrevkw(repo, ctx, **kwargs)
|
||||
|
||||
|
||||
def _svnrevkw(repo, ctx, **kwargs):
|
||||
""":svnrev: String. Converted subversion revision number.
|
||||
|
||||
Isolating this method allows easy wrapping by other extensions like
|
||||
globalrevs.
|
||||
"""
|
||||
convertinfo = util.getsvnrev(ctx, "")
|
||||
|
||||
if not convertinfo or not convertinfo.startswith("svn:"):
|
||||
return ""
|
||||
|
Loading…
Reference in New Issue
Block a user