|
a/ForgeSVN/forgesvn/model/svn.py |
|
b/ForgeSVN/forgesvn/model/svn.py |
|
... |
|
... |
18 |
|
18 |
|
19 |
from ming.base import Object
|
19 |
from ming.base import Object
|
20 |
from ming.orm import Mapper, FieldProperty, session
|
20 |
from ming.orm import Mapper, FieldProperty, session
|
21 |
from ming.utils import LazyProperty
|
21 |
from ming.utils import LazyProperty
|
22 |
|
22 |
|
23 |
import allura.tasks
|
|
|
24 |
from allura import model as M
|
23 |
from allura import model as M
|
25 |
from allura.lib import helpers as h
|
24 |
from allura.lib import helpers as h
|
26 |
from allura.model.repository import GitLikeTree
|
25 |
from allura.model.repository import GitLikeTree
|
27 |
from allura.model.auth import User
|
26 |
from allura.model.auth import User
|
28 |
|
27 |
|
|
... |
|
... |
66 |
return list(self._log(rev=branch, skip=offset, max_count=limit))
|
65 |
return list(self._log(rev=branch, skip=offset, max_count=limit))
|
67 |
|
66 |
|
68 |
def latest(self, branch=None):
|
67 |
def latest(self, branch=None):
|
69 |
if self._impl is None: return None
|
68 |
if self._impl is None: return None
|
70 |
if not self.heads: return None
|
69 |
if not self.heads: return None
|
71 |
last_id = self.heads[0].object_id
|
|
|
72 |
# check the latest revision on the real repo because sometimes the refresh gets stuck
|
|
|
73 |
info = self._impl._svn.info2(
|
|
|
74 |
self._impl._url,
|
|
|
75 |
revision=pysvn.Revision(pysvn.opt_revision_kind.head),
|
|
|
76 |
recurse=False)[0][1]
|
|
|
77 |
if info.rev.number > int(last_id.split(':')[1]):
|
|
|
78 |
last_id = self._impl._oid(info.rev.number)
|
|
|
79 |
# the repo is in a bad state, run a refresh
|
|
|
80 |
allura.tasks.repo_tasks.refresh.post()
|
|
|
81 |
return self._impl.commit(last_id)
|
70 |
return self._impl.commit(self.heads[0].object_id)
|
82 |
|
71 |
|
83 |
|
72 |
|
84 |
class SVNCalledProcessError(Exception):
|
73 |
class SVNCalledProcessError(Exception):
|
85 |
def __init__(self, cmd, returncode, stdout, stderr):
|
74 |
def __init__(self, cmd, returncode, stdout, stderr):
|
86 |
self.cmd = cmd
|
75 |
self.cmd = cmd
|