| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -29,6 +29,7 @@ def _init_externals(): | |||
| 29 | 29 | from git.refs import * | |
| 30 | 30 | from git.diff import * | |
| 31 | 31 | from git.exc import * | |
| 32 | + from git.db import * | ||
| 32 | 33 | from git.cmd import Git | |
| 33 | 34 | from git.repo import Repo | |
| 34 | 35 | from git.remote import * | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -34,13 +34,13 @@ def __init__(self, root_path, git): | |||
| 34 | 34 | self._git = git | |
| 35 | 35 | ||
| 36 | 36 | def info(self, sha): | |
| 37 | - t = self._git.get_object_header(bin_to_hex(sha)) | ||
| 38 | - return OInfo(*t) | ||
| 37 | + hexsha, typename, size = self._git.get_object_header(bin_to_hex(sha)) | ||
| 38 | + return OInfo(hex_to_bin(hexsha), typename, size) | ||
| 39 | 39 | ||
| 40 | 40 | def stream(self, sha): | |
| 41 | 41 | """For now, all lookup is done by git itself""" | |
| 42 | - t = self._git.stream_object_data(bin_to_hex(sha)) | ||
| 43 | - return OStream(*t) | ||
| 42 | + hexsha, typename, size, stream = self._git.stream_object_data(bin_to_hex(sha)) | ||
| 43 | + return OStream(hex_to_bin(hexsha), typename, size, stream) | ||
| 44 | 44 | ||
| 45 | 45 | ||
| 46 | 46 | # { Interface | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -34,6 +34,11 @@ | |||
| 34 | 34 | import sys | |
| 35 | 35 | import re | |
| 36 | 36 | ||
| 37 | + DefaultDBType = GitDB | ||
| 38 | + if sys.version_info[1] < 5: # python 2.4 compatiblity | ||
| 39 | + DefaultDBType = GitCmdObjectDB | ||
| 40 | + # END handle python 2.4 | ||
| 41 | + | ||
| 37 | 42 | ||
| 38 | 43 | __all__ = ('Repo', ) | |
| 39 | 44 | ||
@@ -66,7 +71,7 @@ class Repo(object): | |||
| 66 | 71 | # represents the configuration level of a configuration file | |
| 67 | 72 | config_level = ("system", "global", "repository") | |
| 68 | 73 | ||
| 69 | - def __init__(self, path=None, odbt = GitDB): | ||
| 74 | + def __init__(self, path=None, odbt = DefaultDBType): | ||
| 70 | 75 | """Create a new Repo instance | |
| 71 | 76 | ||
| 72 | 77 | :param path: is the path to either the root git directory or the bare git repo:: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -545,3 +545,10 @@ def test_rev_parse(self): | |||
| 545 | 545 | ||
| 546 | 546 | # cannot handle rev-log for now | |
| 547 | 547 | self.failUnlessRaises(ValueError, rev_parse, "hi@there") | |
| 548 | + | ||
| 549 | + def test_repo_odbtype(self): | ||
| 550 | + target_type = GitDB | ||
| 551 | + if sys.version_info[1] < 5: | ||
| 552 | + target_type = GitCmdObjectDB | ||
| 553 | + assert isinstance(self.rorepo.odb, target_type) | ||
| 554 | + | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments