Skip to content

Commit

Permalink
Fixed #5237 -- Added an optional 'path' argument to get_svn_revision(…
Browse files Browse the repository at this point in the history
…). Thanks, django@poelzi.org

git-svn-id: http://code.djangoproject.com/svn/django/trunk@5995 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
adrianholovaty committed Aug 24, 2007
1 parent 3a4b139 commit 4652c96
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions django/utils/version.py
Expand Up @@ -2,16 +2,22 @@
import os.path import os.path
import re import re


def get_svn_revision(): def get_svn_revision(path=None):
""" """
Returns the SVN revision in the form SVN-XXXX, Returns the SVN revision in the form SVN-XXXX,
where XXXX is the revision number. where XXXX is the revision number.
Returns SVN-unknown if anything goes wrong, such as an unexpected Returns SVN-unknown if anything goes wrong, such as an unexpected
format of internal SVN files. 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 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): if os.path.exists(entries_path):
entries = open(entries_path, 'r').read() entries = open(entries_path, 'r').read()
Expand Down

0 comments on commit 4652c96

Please sign in to comment.