changeset 1009:f0bde4bf1f78

revsets: add support for 'r123' revision labels This is controlled by an hgsubversion.nativerevs boolean (off by default).
author Matt Mackall <mpm@selenic.com>
date Tue, 23 Apr 2013 13:59:38 -0500
parents bdc9b21ea8d0
children f0ebc7113429
files hgsubversion/__init__.py hgsubversion/util.py
diffstat 2 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgsubversion/__init__.py
+++ b/hgsubversion/__init__.py
@@ -180,6 +180,9 @@ def reposetup(ui, repo):
         for tunnel in ui.configlist('hgsubversion', 'tunnels'):
             hg.schemes['svn+' + tunnel] = svnrepo
 
+    if revset and ui.configbool('hgsubversion', 'nativerevs'):
+        extensions.wrapfunction(revset, 'stringset', util.revset_stringset)
+
 _old_local = hg.schemes['file']
 def _lookup(url):
     if util.islocalrepo(url):
--- a/hgsubversion/util.py
+++ b/hgsubversion/util.py
@@ -340,6 +340,11 @@ revsets = {
     'svnrev': revset_svnrev,
 }
 
+def revset_stringset(orig, repo, subset, x):
+    if x.startswith('r') and x[1:].isdigit():
+        return revset_svnrev(repo, subset, ('string', x[1:]))
+    return orig
+
 def getfilestoresize(ui):
     """Return the replay or stupid file memory store size in megabytes or -1"""
     size = ui.configint('hgsubversion', 'filestoresize', 200)