16
16
# You should have received a copy of the GNU General Public License
17
17
# along with this program; if not, write to the Free Software
18
# Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
18
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25
25
from paste.httpexceptions import HTTPNotFound, HTTPMovedPermanently
27
from breezy import errors
28
from breezy.revision import is_null as is_null_rev
27
from bzrlib import errors
28
from bzrlib.revision import is_null as is_null_rev
30
30
from loggerhead import util
31
31
from loggerhead.controllers import TemplatedBranchView
44
44
template_path = 'loggerhead.templates.inventory'
45
45
supports_json = True
47
def get_filelist(self, tree, path, sort_type, revno_url):
47
def get_filelist(self, inv, path, sort_type, revno_url):
49
49
return the list of all files (and their attributes) within a given
53
@param path: The path of a directory within the tree.
52
@param inv: The inventory.
53
@param path: The path of a directory within the inventory.
54
54
@param sort_type: How to sort the results... XXX.
56
file_id = inv.path2id(path)
58
if tree.kind(path) != 'directory':
60
if dir_ie.kind != 'directory':
59
61
raise HTTPMovedPermanently(self._branch.context_url(['/view', revno_url, path]))
63
child_entries = list(tree.iter_child_entries(path))
65
for entry in child_entries:
65
for filename, entry in dir_ie.children.iteritems():
66
66
revid_set.add(entry.revision)
69
69
for change in self._history.get_changes(list(revid_set)):
70
70
change_dict[change.revid] = change
72
for entry in child_entries:
72
for filename, entry in dir_ie.children.iteritems():
74
74
if entry.kind == 'directory':
85
85
# including the revision id and having a separate request to get
86
86
# back the revision info.
87
87
file = util.Container(
88
filename=entry.name, executable=entry.executable,
88
filename=filename, executable=entry.executable,
89
89
kind=entry.kind, absolutepath=absolutepath,
90
90
file_id=entry.file_id, size=entry.text_size, revid=revid,
91
91
change=change_dict[revid])
145
145
revno_url = history.get_revno(revid)
146
146
history.add_branch_nicks(change)
147
filelist = self.get_filelist(rev_tree, path, sort_type, revno_url)
147
filelist = self.get_filelist(rev_tree.inventory, path, sort_type, revno_url)
150
150
start_revid = None