| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,12 +1,9 @@ | |||
| 1 | 1 | """Module with our own gitdb implementation - it uses the git command""" | |
| 2 | + from git.util import bin_to_hex, hex_to_bin | ||
| 2 | 3 | from gitdb.base import ( | |
| 3 | 4 | OInfo, | |
| 4 | 5 | OStream | |
| 5 | 6 | ) | |
| 6 | - from gitdb.util import ( | ||
| 7 | - bin_to_hex, | ||
| 8 | - hex_to_bin | ||
| 9 | - ) | ||
| 10 | 7 | from gitdb.db import GitDB # @UnusedImport | |
| 11 | 8 | from gitdb.db import LooseObjectDB | |
| 12 | 9 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,18 +5,17 @@ | |||
| 5 | 5 | # the BSD License: http://www.opensource.org/licenses/bsd-license.php | |
| 6 | 6 | import re | |
| 7 | 7 | ||
| 8 | - from gitdb.util import hex_to_bin | ||
| 8 | + from git.cmd import handle_process_output | ||
| 9 | + from git.compat import ( | ||
| 10 | + defenc, | ||
| 11 | + PY3 | ||
| 12 | + ) | ||
| 13 | + from git.util import finalize_process, hex_to_bin | ||
| 9 | 14 | ||
| 10 | 15 | from .compat import binary_type | |
| 11 | 16 | from .objects.blob import Blob | |
| 12 | 17 | from .objects.util import mode_str_to_int | |
| 13 | 18 | ||
| 14 | - from git.compat import ( | ||
| 15 | - defenc, | ||
| 16 | - PY3 | ||
| 17 | - ) | ||
| 18 | - from git.cmd import handle_process_output | ||
| 19 | - from git.util import finalize_process | ||
| 20 | 19 | ||
| 21 | 20 | __all__ = ('Diffable', 'DiffIndex', 'Diff', 'NULL_TREE') | |
| 22 | 21 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -39,11 +39,11 @@ | |||
| 39 | 39 | join_path_native, | |
| 40 | 40 | file_contents_ro, | |
| 41 | 41 | to_native_path_linux, | |
| 42 | - unbare_repo | ||
| 42 | + unbare_repo, | ||
| 43 | + to_bin_sha | ||
| 43 | 44 | ) | |
| 44 | 45 | from gitdb.base import IStream | |
| 45 | 46 | from gitdb.db import MemoryDB | |
| 46 | - from gitdb.util import to_bin_sha | ||
| 47 | 47 | ||
| 48 | 48 | import git.diff as diff | |
| 49 | 49 | import os.path as osp | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,14 +3,13 @@ | |||
| 3 | 3 | # | |
| 4 | 4 | # This module is part of GitPython and is released under | |
| 5 | 5 | # the BSD License: http://www.opensource.org/licenses/bsd-license.php | |
| 6 | - from .util import get_object_type_by_name | ||
| 7 | - from git.util import LazyMixin, join_path_native, stream_copy | ||
| 8 | - from gitdb.util import ( | ||
| 9 | - bin_to_hex, | ||
| 10 | - basename | ||
| 11 | - ) | ||
| 6 | + from git.util import LazyMixin, join_path_native, stream_copy, bin_to_hex | ||
| 12 | 7 | ||
| 13 | 8 | import gitdb.typ as dbtyp | |
| 9 | + import os.path as osp | ||
| 10 | + | ||
| 11 | + from .util import get_object_type_by_name | ||
| 12 | + | ||
| 14 | 13 | ||
| 15 | 14 | _assertion_msg_format = "Created object %r whose python type %r disagrees with the acutal git object type %r" | |
| 16 | 15 | ||
@@ -170,7 +169,7 @@ def _set_cache_(self, attr): | |||
| 170 | 169 | @property | |
| 171 | 170 | def name(self): | |
| 172 | 171 | """:return: Name portion of the path, effectively being the basename""" | |
| 173 | - return basename(self.path) | ||
| 172 | + return osp.basename(self.path) | ||
| 174 | 173 | ||
| 175 | 174 | @property | |
| 176 | 175 | def abspath(self): | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,8 +5,8 @@ | |||
| 5 | 5 | # the BSD License: http://www.opensource.org/licenses/bsd-license.php | |
| 6 | 6 | ||
| 7 | 7 | from gitdb import IStream | |
| 8 | - from gitdb.util import hex_to_bin | ||
| 9 | 8 | from git.util import ( | |
| 9 | + hex_to_bin, | ||
| 10 | 10 | Actor, | |
| 11 | 11 | Iterable, | |
| 12 | 12 | Stats, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,12 +5,9 @@ | |||
| 5 | 5 | # the BSD License: http://www.opensource.org/licenses/bsd-license.php | |
| 6 | 6 | """ Module containing all object based types. """ | |
| 7 | 7 | from . import base | |
| 8 | - from .util import ( | ||
| 9 | - get_object_type_by_name, | ||
| 10 | - parse_actor_and_date | ||
| 11 | - ) | ||
| 12 | - from gitdb.util import hex_to_bin | ||
| 13 | - from git.compat import defenc | ||
| 8 | + from .util import get_object_type_by_name, parse_actor_and_date | ||
| 9 | + from ..util import hex_to_bin | ||
| 10 | + from ..compat import defenc | ||
| 14 | 11 | ||
| 15 | 12 | __all__ = ("TagObject", ) | |
| 16 | 13 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,7 +5,7 @@ | |||
| 5 | 5 | # the BSD License: http://www.opensource.org/licenses/bsd-license.php | |
| 6 | 6 | from git.util import join_path | |
| 7 | 7 | import git.diff as diff | |
| 8 | - from gitdb.util import to_bin_sha | ||
| 8 | + from git.util import to_bin_sha | ||
| 9 | 9 | ||
| 10 | 10 | from . import util | |
| 11 | 11 | from .base import IndexObject | |
@@ -18,7 +18,7 @@ | |||
| 18 | 18 | tree_to_stream | |
| 19 | 19 | ) | |
| 20 | 20 | ||
| 21 | - from gitdb.utils.compat import PY3 | ||
| 21 | + from git.compat import PY3 | ||
| 22 | 22 | ||
| 23 | 23 | if PY3: | |
| 24 | 24 | cmp = lambda a, b: (a > b) - (a < b) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,31 +1,29 @@ | |||
| 1 | + import re | ||
| 2 | + import time | ||
| 3 | + | ||
| 4 | + from git.compat import ( | ||
| 5 | + PY3, | ||
| 6 | + xrange, | ||
| 7 | + string_types, | ||
| 8 | + defenc | ||
| 9 | + ) | ||
| 10 | + from git.objects.util import ( | ||
| 11 | + parse_date, | ||
| 12 | + Serializable, | ||
| 13 | + altz_to_utctz_str, | ||
| 14 | + ) | ||
| 1 | 15 | from git.util import ( | |
| 2 | 16 | Actor, | |
| 3 | 17 | LockedFD, | |
| 4 | 18 | LockFile, | |
| 5 | 19 | assure_directory_exists, | |
| 6 | 20 | to_native_path, | |
| 7 | - ) | ||
| 8 | - | ||
| 9 | - from gitdb.util import ( | ||
| 10 | 21 | bin_to_hex, | |
| 11 | - join, | ||
| 12 | - file_contents_ro_filepath, | ||
| 22 | + file_contents_ro_filepath | ||
| 13 | 23 | ) | |
| 14 | 24 | ||
| 15 | - from git.objects.util import ( | ||
| 16 | - parse_date, | ||
| 17 | - Serializable, | ||
| 18 | - altz_to_utctz_str, | ||
| 19 | - ) | ||
| 20 | - from git.compat import ( | ||
| 21 | - PY3, | ||
| 22 | - xrange, | ||
| 23 | - string_types, | ||
| 24 | - defenc | ||
| 25 | - ) | ||
| 25 | + import os.path as osp | ||
| 26 | 26 | ||
| 27 | - import time | ||
| 28 | - import re | ||
| 29 | 27 | ||
| 30 | 28 | __all__ = ["RefLog", "RefLogEntry"] | |
| 31 | 29 | ||
@@ -185,7 +183,7 @@ def path(cls, ref): | |||
| 185 | 183 | instance would be found. The path is not guaranteed to point to a valid | |
| 186 | 184 | file though. | |
| 187 | 185 | :param ref: SymbolicReference instance""" | |
| 188 | - return join(ref.repo.git_dir, "logs", to_native_path(ref.path)) | ||
| 186 | + return osp.join(ref.repo.git_dir, "logs", to_native_path(ref.path)) | ||
| 189 | 187 | ||
| 190 | 188 | @classmethod | |
| 191 | 189 | def iter_entries(cls, stream): | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,9 +1,10 @@ | |||
| 1 | + import os | ||
| 2 | + | ||
| 1 | 3 | from git.util import join_path | |
| 2 | - from gitdb.util import join | ||
| 3 | 4 | ||
| 4 | - from .head import Head | ||
| 5 | + import os.path as osp | ||
| 5 | 6 | ||
| 6 | - import os | ||
| 7 | + from .head import Head | ||
| 7 | 8 | ||
| 8 | 9 | ||
| 9 | 10 | __all__ = ["RemoteReference"] | |
@@ -36,7 +37,7 @@ def delete(cls, repo, *refs, **kwargs): | |||
| 36 | 37 | # and delete remainders manually | |
| 37 | 38 | for ref in refs: | |
| 38 | 39 | try: | |
| 39 | - os.remove(join(repo.git_dir, ref.path)) | ||
| 40 | + os.remove(osp.join(repo.git_dir, ref.path)) | ||
| 40 | 41 | except OSError: | |
| 41 | 42 | pass | |
| 42 | 43 | # END for each ref | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,22 +9,14 @@ | |||
| 9 | 9 | join_path, | |
| 10 | 10 | join_path_native, | |
| 11 | 11 | to_native_path_linux, | |
| 12 | - assure_directory_exists | ||
| 12 | + assure_directory_exists, | ||
| 13 | + hex_to_bin, | ||
| 14 | + LockedFD | ||
| 13 | 15 | ) | |
| 14 | 16 | from gitdb.exc import ( | |
| 15 | 17 | BadObject, | |
| 16 | 18 | BadName | |
| 17 | 19 | ) | |
| 18 | - from gitdb.util import ( | ||
| 19 | - join, | ||
| 20 | - dirname, | ||
| 21 | - isdir, | ||
| 22 | - exists, | ||
| 23 | - isfile, | ||
| 24 | - rename, | ||
| 25 | - hex_to_bin, | ||
| 26 | - LockedFD | ||
| 27 | - ) | ||
| 28 | 20 | ||
| 29 | 21 | import os.path as osp | |
| 30 | 22 | ||
@@ -83,7 +75,7 @@ def abspath(self): | |||
| 83 | 75 | ||
| 84 | 76 | @classmethod | |
| 85 | 77 | def _get_packed_refs_path(cls, repo): | |
| 86 | - return join(repo.git_dir, 'packed-refs') | ||
| 78 | + return osp.join(repo.git_dir, 'packed-refs') | ||
| 87 | 79 | ||
| 88 | 80 | @classmethod | |
| 89 | 81 | def _iter_packed_refs(cls, repo): | |
@@ -136,7 +128,7 @@ def _get_ref_info(cls, repo, ref_path): | |||
| 136 | 128 | point to, or None""" | |
| 137 | 129 | tokens = None | |
| 138 | 130 | try: | |
| 139 | - with open(join(repo.git_dir, ref_path), 'rt') as fp: | ||
| 131 | + with open(osp.join(repo.git_dir, ref_path), 'rt') as fp: | ||
| 140 | 132 | value = fp.read().rstrip() | |
| 141 | 133 | # Don't only split on spaces, but on whitespace, which allows to parse lines like | |
| 142 | 134 | # 60b64ef992065e2600bfef6187a97f92398a9144 branch 'master' of git-server:/path/to/repo | |
@@ -420,8 +412,8 @@ def delete(cls, repo, path): | |||
| 420 | 412 | or just "myreference", hence 'refs/' is implied. | |
| 421 | 413 | Alternatively the symbolic reference to be deleted""" | |
| 422 | 414 | full_ref_path = cls.to_full_path(path) | |
| 423 | - abs_path = join(repo.git_dir, full_ref_path) | ||
| 424 | - if exists(abs_path): | ||
| 415 | + abs_path = osp.join(repo.git_dir, full_ref_path) | ||
| 416 | + if osp.exists(abs_path): | ||
| 425 | 417 | os.remove(abs_path) | |
| 426 | 418 | else: | |
| 427 | 419 | # check packed refs | |
@@ -472,14 +464,14 @@ def _create(cls, repo, path, resolve, reference, force, logmsg=None): | |||
| 472 | 464 | corresponding object and a detached symbolic reference will be created | |
| 473 | 465 | instead""" | |
| 474 | 466 | full_ref_path = cls.to_full_path(path) | |
| 475 | - abs_ref_path = join(repo.git_dir, full_ref_path) | ||
| 467 | + abs_ref_path = osp.join(repo.git_dir, full_ref_path) | ||
| 476 | 468 | ||
| 477 | 469 | # figure out target data | |
| 478 | 470 | target = reference | |
| 479 | 471 | if resolve: | |
| 480 | 472 | target = repo.rev_parse(str(reference)) | |
| 481 | 473 | ||
| 482 | - if not force and isfile(abs_ref_path): | ||
| 474 | + if not force and osp.isfile(abs_ref_path): | ||
| 483 | 475 | target_data = str(target) | |
| 484 | 476 | if isinstance(target, SymbolicReference): | |
| 485 | 477 | target_data = target.path | |
@@ -546,9 +538,9 @@ def rename(self, new_path, force=False): | |||
| 546 | 538 | if self.path == new_path: | |
| 547 | 539 | return self | |
| 548 | 540 | ||
| 549 | - new_abs_path = join(self.repo.git_dir, new_path) | ||
| 550 | - cur_abs_path = join(self.repo.git_dir, self.path) | ||
| 551 | - if isfile(new_abs_path): | ||
| 541 | + new_abs_path = osp.join(self.repo.git_dir, new_path) | ||
| 542 | + cur_abs_path = osp.join(self.repo.git_dir, self.path) | ||
| 543 | + if osp.isfile(new_abs_path): | ||
| 552 | 544 | if not force: | |
| 553 | 545 | # if they point to the same file, its not an error | |
| 554 | 546 | with open(new_abs_path, 'rb') as fd1: | |
@@ -563,12 +555,12 @@ def rename(self, new_path, force=False): | |||
| 563 | 555 | os.remove(new_abs_path) | |
| 564 | 556 | # END handle existing target file | |
| 565 | 557 | ||
| 566 | - dname = dirname(new_abs_path) | ||
| 567 | - if not isdir(dname): | ||
| 558 | + dname = osp.dirname(new_abs_path) | ||
| 559 | + if not osp.isdir(dname): | ||
| 568 | 560 | os.makedirs(dname) | |
| 569 | 561 | # END create directory | |
| 570 | 562 | ||
| 571 | - rename(cur_abs_path, new_abs_path) | ||
| 563 | + os.rename(cur_abs_path, new_abs_path) | ||
| 572 | 564 | self.path = new_path | |
| 573 | 565 | ||
| 574 | 566 | return self | |
| Back | FazBrowse Home | New Git URL |
0 commit comments