diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2007-08-24 03:53:04 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2007-08-24 03:53:04 +0000 |
| commit | 4652c96de1843e8176837e7c3f56b925301fa30c (patch) | |
| tree | 81cf3ebf3365942d0ce9d0d04d8749ead3b2d749 /django/utils/version.py | |
| parent | 3a4b139636e755db36d8bb7f4c1180ad9da84aab (diff) | |
Fixed #5237 -- Added an optional 'path' argument to get_svn_revision(). Thanks, django@poelzi.org
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5995 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/utils/version.py')
| -rw-r--r-- | django/utils/version.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/django/utils/version.py b/django/utils/version.py index dd8345d8d2..cf8085653f 100644 --- a/django/utils/version.py +++ b/django/utils/version.py @@ -2,16 +2,22 @@ import django import os.path import re -def get_svn_revision(): +def get_svn_revision(path=None): """ Returns the SVN revision in the form SVN-XXXX, where XXXX is the revision number. Returns SVN-unknown if anything goes wrong, such as an unexpected format of internal SVN files. + + If path is provided, it should be a directory whose SVN info you want to + inspect. If it's not provided, this will use the root django/ package + directory. """ rev = None - entries_path = '%s/.svn/entries' % django.__path__[0] + if path is None: + path = django.__path__[0] + entries_path = '%s/.svn/entries' % path if os.path.exists(entries_path): entries = open(entries_path, 'r').read() |
