• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

allura


Commit MetaInfo

Revision029847379a77264d6cd1fd0ea7a54fe73d979005 (tree)
Zeit2012-06-28 01:59:41
AutorTim Van Steenburgh <tvansteenburgh@gmai...>
CommiterTim Van Steenburgh

Log Message

[#4126] Fix scm file stats to work with new model.

Signed-off-by: Tim Van Steenburgh <tvansteenburgh@gmail.com>

Ändern Zusammenfassung

Diff

--- a/Allura/allura/model/repo.py
+++ b/Allura/allura/model/repo.py
@@ -470,6 +470,10 @@ class Blob(object):
470470 return iter(self.open())
471471
472472 @LazyProperty
473+ def size(self):
474+ return self.repo.blob_size(self)
475+
476+ @LazyProperty
473477 def text(self):
474478 return self.open().read()
475479
--- a/Allura/allura/tests/test_commands.py
+++ b/Allura/allura/tests/test_commands.py
@@ -1,8 +1,8 @@
11 from nose.tools import assert_raises
22
33 from alluratest.controller import setup_basic_test, setup_global_objects
4-from allura.command import script, set_neighborhood_features, rssfeeds, \
5-create_neighborhood
4+from allura.command import script, set_neighborhood_features, \
5+ create_neighborhood
66 from allura import model as M
77 from forgeblog import model as BM
88 from allura.lib.exceptions import InvalidNBFeatureValueError
--- a/ForgeGit/forgegit/model/git_repo.py
+++ b/ForgeGit/forgegit/model/git_repo.py
@@ -240,7 +240,7 @@ class GitImplementation(M.RepositoryImplementation):
240240 self._object(blob._id).data_stream)
241241
242242 def blob_size(self, blob):
243- return self._object(blob.object_id).data_stream.size
243+ return self._object(blob._id).data_stream.size
244244
245245 def _setup_hooks(self):
246246 'Set up the git post-commit hook'
--- a/ForgeHg/forgehg/model/hg.py
+++ b/ForgeHg/forgehg/model/hg.py
@@ -230,7 +230,7 @@ class HgImplementation(M.RepositoryImplementation):
230230 return StringIO(fctx.data())
231231
232232 def blob_size(self, blob):
233- fctx = self._hg[blob.commit.object_id][h.really_unicode(blob.path()).encode('utf-8')[1:]]
233+ fctx = self._hg[blob.commit._id][h.really_unicode(blob.path()).encode('utf-8')[1:]]
234234 return fctx.size()
235235
236236 def _setup_hooks(self):
--- a/ForgeSVN/forgesvn/model/svn.py
+++ b/ForgeSVN/forgesvn/model/svn.py
@@ -382,7 +382,7 @@ class SVNImplementation(M.RepositoryImplementation):
382382 try:
383383 data = self._svn.list(
384384 self._url + blob.path(),
385- revision=self._revision(blob.commit.object_id),
385+ revision=self._revision(blob.commit._id),
386386 dirent_fields=pysvn.SVN_DIRENT_SIZE)
387387 except pysvn.ClientError:
388388 log.info('ClientError getting filesize %r %r, returning 0', blob.path(), self._repo, exc_info=True)
@@ -393,7 +393,7 @@ class SVNImplementation(M.RepositoryImplementation):
393393 except (IndexError, KeyError):
394394 log.info('Error getting filesize: bad data from svn client %r %r, returning 0', blob.path(), self._repo, exc_info=True)
395395 size = 0
396-
396+
397397 return size
398398
399399 def _setup_hooks(self):