[viewvc-dev] [PATCH] issue #441: Allow "rNNN" formatting for Subversion revision specifiers
Daniel Shahaf <[email protected]> Wed, 16 Jun 2010 21:33:03 +0300 (IDT)
| Newsgroups | gmane.comp.version-control.cvs.viewcvs.devel |
|---|---|
| Message-ID | <alpine.561.2.00.1006162128300.26604__42938.8209399351$1276715402$gmane$org@daniel1.local> |
I keep pointing my browser at, e.g.,
http://svn.apache.org/viewvc?view=revision&revision=r840075
....................................................^
and I'm tired of removing that 'r'.
So, here's a quick patch to accept that 'r' :-)
I've only tried it with standalone.py.
Daniel
(by the way, as reported on IRC: to make standalone.py work, I had to
provide a config file with svn_roots= set and run 'cd conf; ln -s ../templates')
[[[
Index: lib/vclib/svn/svn_repos.py
===================================================================
--- lib/vclib/svn/svn_repos.py (revision 2402)
+++ lib/vclib/svn/svn_repos.py (working copy)
@@ -727,6 +727,8 @@ class LocalSubversionRepository(vclib.Repository):
if rev is None or rev == 'HEAD':
return self.youngest
try:
+ if type(rev) == type(''):
+ rev = re.sub('^r*', '', rev)
rev = int(rev)
except ValueError:
raise vclib.InvalidRevision(rev)
Index: lib/vclib/svn/svn_ra.py
===================================================================
--- lib/vclib/svn/svn_ra.py (revision 2402)
+++ lib/vclib/svn/svn_ra.py (working copy)
@@ -404,6 +404,8 @@ class RemoteSubversionRepository(vclib.Repository)
if rev is None or rev == 'HEAD':
return self.youngest
try:
+ if type(rev) == type(''):
+ rev = re.sub('^r*', '', rev)
rev = int(rev)
except ValueError:
raise vclib.InvalidRevision(rev)
Index: lib/viewvc.py
===================================================================
--- lib/viewvc.py (revision 2402)
+++ lib/viewvc.py (working copy)
@@ -658,7 +658,7 @@ _re_validate_number = re.compile('^[0-9]+$')
_re_validate_boolint = re.compile('^[01]$')
# when comparing two revs, we sometimes construct REV:SYMBOL, so ':' is needed
-_re_validate_revnum = re.compile('^[-_.a-zA-Z0-9:~\\[\\]/]*$')
+_re_validate_revnum = re.compile('^r?[-_.a-zA-Z0-9:~\\[\\]/]*$')
# date time values
_re_validate_datetime = re.compile(r'^(\d\d\d\d-\d\d-\d\d(\s+\d\d:\d\d'
]]]
------------------------------------------------------
http://viewvc.tigris.org/ds/viewMessage.do?dsForumId=4251&dsMessageId=2622595
To unsubscribe from this discussion, e-mail: [[email protected]].