| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -66,7 +66,7 @@ New BSD License. See the LICENSE file. | |||
| 66 | 66 | ### DEVELOPMENT STATUS | |
| 67 | 67 | ||
| 68 | 68 | [](https://travis-ci.org/gitpython-developers/GitPython) | |
| 69 | - [](https://coveralls.io/r/gitpython-developers/GitPython) | ||
| 69 | + [](https://coveralls.io/r/gitpython-developers/GitPython?branch=0.3) | ||
| 70 | 70 | [](https://readthedocs.org/projects/gitpython/?badge=stable) | |
| 71 | 71 | ||
| 72 | 72 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1 +1 @@ | |||
| 1 | - 0.3.2.1 | ||
| 1 | + 0.3.3 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,6 +5,9 @@ Changelog | |||
| 5 | 5 | 0.3.3 | |
| 6 | 6 | ===== | |
| 7 | 7 | * When fetching, pulling or pushing, and an error occours, it will not be reported on stdout anymore. However, if there is a fatal error, it will still result in a GitCommandError to be thrown. This goes hand in hand with improved fetch result parsing. | |
| 8 | + * Code Cleanup (in preparation for python 3 support) | ||
| 9 | + * Applied autopep8 and cleaned up code | ||
| 10 | + * Using python logging module instead of print statments to signal certain kinds of errors | ||
| 8 | 11 | ||
| 9 | 12 | 0.3.2.1 | |
| 10 | 13 | ======= | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -334,7 +334,7 @@ def execute(self, command, | |||
| 334 | 334 | If you add additional keyword arguments to the signature of this method, | |
| 335 | 335 | you must update the execute_kwargs tuple housed in this module.""" | |
| 336 | 336 | if self.GIT_PYTHON_TRACE and (self.GIT_PYTHON_TRACE != 'full' or as_process): | |
| 337 | - print ' '.join(command) | ||
| 337 | + print(' '.join(command)) | ||
| 338 | 338 | ||
| 339 | 339 | # Allow the user to have the command executed in their working dir. | |
| 340 | 340 | if with_keep_cwd or self._working_dir is None: | |
@@ -389,11 +389,11 @@ def execute(self, command, | |||
| 389 | 389 | if self.GIT_PYTHON_TRACE == 'full': | |
| 390 | 390 | cmdstr = " ".join(command) | |
| 391 | 391 | if stderr_value: | |
| 392 | - print "%s -> %d; stdout: '%s'; stderr: '%s'" % (cmdstr, status, stdout_value, stderr_value) | ||
| 392 | + print("%s -> %d; stdout: '%s'; stderr: '%s'" % (cmdstr, status, stdout_value, stderr_value)) | ||
| 393 | 393 | elif stdout_value: | |
| 394 | - print "%s -> %d; stdout: '%s'" % (cmdstr, status, stdout_value) | ||
| 394 | + print("%s -> %d; stdout: '%s'" % (cmdstr, status, stdout_value)) | ||
| 395 | 395 | else: | |
| 396 | - print "%s -> %d" % (cmdstr, status) | ||
| 396 | + print("%s -> %d" % (cmdstr, status)) | ||
| 397 | 397 | # END handle debug printing | |
| 398 | 398 | ||
| 399 | 399 | if with_exceptions and status != 0: | |
@@ -522,14 +522,16 @@ def make_call(): | |||
| 522 | 522 | raise | |
| 523 | 523 | # END handle overridden variable | |
| 524 | 524 | type(self).GIT_PYTHON_GIT_EXECUTABLE = self.git_exec_name_win | |
| 525 | - call = [self.GIT_PYTHON_GIT_EXECUTABLE] + list(args) | ||
| 526 | 525 | ||
| 527 | 526 | try: | |
| 528 | 527 | return self.execute(make_call(), **_kwargs) | |
| 529 | 528 | finally: | |
| 530 | 529 | import warnings | |
| 531 | - msg = "WARNING: Automatically switched to use git.cmd as git executable, which reduces performance by ~70%." | ||
| 532 | - msg += "Its recommended to put git.exe into the PATH or to set the %s environment variable to the executable's location" % self._git_exec_env_var | ||
| 530 | + msg = "WARNING: Automatically switched to use git.cmd as git executable" | ||
| 531 | + msg += ", which reduces performance by ~70%." | ||
| 532 | + msg += "Its recommended to put git.exe into the PATH or to " | ||
| 533 | + msg += "set the %s " % self._git_exec_env_var | ||
| 534 | + msg += "environment variable to the executable's location" | ||
| 533 | 535 | warnings.warn(msg) | |
| 534 | 536 | # END print of warning | |
| 535 | 537 | # END catch first failure | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,10 +7,8 @@ | |||
| 7 | 7 | configuration files""" | |
| 8 | 8 | ||
| 9 | 9 | import re | |
| 10 | - import os | ||
| 11 | 10 | import ConfigParser as cp | |
| 12 | 11 | import inspect | |
| 13 | - import cStringIO | ||
| 14 | 12 | ||
| 15 | 13 | from git.odict import OrderedDict | |
| 16 | 14 | from git.util import LockFile | |
@@ -188,8 +186,8 @@ def __del__(self): | |||
| 188 | 186 | try: | |
| 189 | 187 | try: | |
| 190 | 188 | self.write() | |
| 191 | - except IOError, e: | ||
| 192 | - print "Exception during destruction of GitConfigParser: %s" % str(e) | ||
| 189 | + except IOError as e: | ||
| 190 | + print("Exception during destruction of GitConfigParser: %s" % str(e)) | ||
| 193 | 191 | finally: | |
| 194 | 192 | self._lock._release_lock() | |
| 195 | 193 | ||
@@ -287,7 +285,7 @@ def read(self): | |||
| 287 | 285 | try: | |
| 288 | 286 | fp = open(file_object) | |
| 289 | 287 | close_fp = True | |
| 290 | - except IOError, e: | ||
| 288 | + except IOError: | ||
| 291 | 289 | continue | |
| 292 | 290 | # END fp handling | |
| 293 | 291 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,7 +7,6 @@ | |||
| 7 | 7 | import re | |
| 8 | 8 | from objects.blob import Blob | |
| 9 | 9 | from objects.util import mode_str_to_int | |
| 10 | - from exc import GitCommandError | ||
| 11 | 10 | ||
| 12 | 11 | from gitdb.util import hex_to_bin | |
| 13 | 12 | ||
@@ -106,7 +105,7 @@ def diff(self, other=Index, paths=None, create_patch=False, **kwargs): | |||
| 106 | 105 | diff_method = Diff._index_from_patch_format | |
| 107 | 106 | index = diff_method(self.repo, proc.stdout) | |
| 108 | 107 | ||
| 109 | - status = proc.wait() | ||
| 108 | + proc.wait() | ||
| 110 | 109 | return index | |
| 111 | 110 | ||
| 112 | 111 | ||
@@ -321,7 +320,7 @@ def _index_from_raw_format(cls, repo, stream): | |||
| 321 | 320 | modify, delete and add files | |
| 322 | 321 | :return: git.DiffIndex""" | |
| 323 | 322 | # handles | |
| 324 | - # :100644 100644 6870991011cc8d9853a7a8a6f02061512c6a8190 37c5e30c879213e9ae83b21e9d11e55fc20c54b7 M .gitignore | ||
| 323 | + # :100644 100644 687099101... 37c5e30c8... M .gitignore | ||
| 325 | 324 | index = DiffIndex() | |
| 326 | 325 | for line in stream: | |
| 327 | 326 | if not line.startswith(":"): | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,6 @@ | |||
| 1 | 1 | """Initialize the index package""" | |
| 2 | 2 | ||
| 3 | - from base import * | ||
| 4 | - from typ import * | ||
| 3 | + from __future__ import absolute_import | ||
| 4 | + | ||
| 5 | + from .base import * | ||
| 6 | + from .typ import * | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,7 +24,6 @@ | |||
| 24 | 24 | git_working_dir | |
| 25 | 25 | ) | |
| 26 | 26 | ||
| 27 | - import git.objects | ||
| 28 | 27 | import git.diff as diff | |
| 29 | 28 | ||
| 30 | 29 | from git.exc import ( | |
@@ -43,13 +42,11 @@ | |||
| 43 | 42 | from git.objects.util import Serializable | |
| 44 | 43 | ||
| 45 | 44 | from git.util import ( | |
| 46 | - IndexFileSHA1Writer, | ||
| 47 | 45 | LazyMixin, | |
| 48 | 46 | LockedFD, | |
| 49 | 47 | join_path_native, | |
| 50 | 48 | file_contents_ro, | |
| 51 | 49 | to_native_path_linux, | |
| 52 | - to_native_path | ||
| 53 | 50 | ) | |
| 54 | 51 | ||
| 55 | 52 | from fun import ( | |
@@ -418,9 +415,6 @@ def iter_blobs(self, predicate=lambda t: True): | |||
| 418 | 415 | iterator. A default filter, the BlobFilter, allows you to yield blobs | |
| 419 | 416 | only if they match a given list of paths. """ | |
| 420 | 417 | for entry in self.entries.itervalues(): | |
| 421 | - # TODO: is it necessary to convert the mode ? We did that when adding | ||
| 422 | - # it to the index, right ? | ||
| 423 | - mode = stat_mode_to_index_mode(entry.mode) | ||
| 424 | 418 | blob = entry.to_blob(self.repo) | |
| 425 | 419 | blob.size = entry.size | |
| 426 | 420 | output = (entry.stage, blob) | |
@@ -602,7 +596,7 @@ def _entries_for_paths(self, paths, path_rewriter, fprogress, entries): | |||
| 602 | 596 | def add(self, items, force=True, fprogress=lambda *args: None, path_rewriter=None, | |
| 603 | 597 | write=True): | |
| 604 | 598 | """Add files from the working tree, specific blobs or BaseIndexEntries | |
| 605 | - to the index. | ||
| 599 | + to the index. | ||
| 606 | 600 | ||
| 607 | 601 | :param items: | |
| 608 | 602 | Multiple types of items are supported, types can be mixed within one call. | |
@@ -630,7 +624,7 @@ def add(self, items, force=True, fprogress=lambda *args: None, path_rewriter=Non | |||
| 630 | 624 | must be a path relative to our repository. | |
| 631 | 625 | ||
| 632 | 626 | If their sha is null ( 40*0 ), their path must exist in the file system | |
| 633 | - relative to the git repository as an object will be created from | ||
| 627 | + relative to the git repository as an object will be created from | ||
| 634 | 628 | the data at the path. | |
| 635 | 629 | The handling now very much equals the way string paths are processed, except that | |
| 636 | 630 | the mode you have set will be kept. This allows you to create symlinks | |
@@ -892,7 +886,8 @@ def commit(self, message, parent_commits=None, head=True, author=None, committer | |||
| 892 | 886 | :return: | |
| 893 | 887 | Commit object representing the new commit""" | |
| 894 | 888 | tree = self.write_tree() | |
| 895 | - return Commit.create_from_tree(self.repo, tree, message, parent_commits, head, author=author, committer=committer) | ||
| 889 | + return Commit.create_from_tree(self.repo, tree, message, parent_commits, | ||
| 890 | + head, author=author, committer=committer) | ||
| 896 | 891 | ||
| 897 | 892 | @classmethod | |
| 898 | 893 | def _flush_stdin_and_wait(cls, proc, ignore_stdout=False): | |
@@ -995,7 +990,8 @@ def handle_stderr(proc, iter_checked_out_files): | |||
| 995 | 990 | if failed_files: | |
| 996 | 991 | valid_files = list(set(iter_checked_out_files) - set(failed_files)) | |
| 997 | 992 | raise CheckoutError( | |
| 998 | - "Some files could not be checked out from the index due to local modifications", failed_files, valid_files, failed_reasons) | ||
| 993 | + "Some files could not be checked out from the index due to local modifications", | ||
| 994 | + failed_files, valid_files, failed_reasons) | ||
| 999 | 995 | # END stderr handler | |
| 1000 | 996 | ||
| 1001 | 997 | if paths is None: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,7 +5,6 @@ | |||
| 5 | 5 | S_IFDIR, | |
| 6 | 6 | S_IFLNK, | |
| 7 | 7 | S_ISLNK, | |
| 8 | - S_IFDIR, | ||
| 9 | 8 | S_ISDIR, | |
| 10 | 9 | S_IFMT, | |
| 11 | 10 | S_IFREG, | |
@@ -146,7 +145,7 @@ def read_cache(stream): | |||
| 146 | 145 | path = read(path_size) | |
| 147 | 146 | ||
| 148 | 147 | real_size = ((tell() - beginoffset + 8) & ~7) | |
| 149 | - data = read((beginoffset + real_size) - tell()) | ||
| 148 | + read((beginoffset + real_size) - tell()) | ||
| 150 | 149 | entry = IndexEntry((mode, sha, flags, path, ctime, mtime, dev, ino, uid, gid, size)) | |
| 151 | 150 | # entry_key would be the method to use, but we safe the effort | |
| 152 | 151 | entries[(path, entry.stage)] = entry | |
@@ -160,8 +159,8 @@ def read_cache(stream): | |||
| 160 | 159 | # 4 bytes length of chunk | |
| 161 | 160 | # repeated 0 - N times | |
| 162 | 161 | extension_data = stream.read(~0) | |
| 163 | - assert len(extension_data) > 19, "Index Footer was not at least a sha on content as it was only %i bytes in size" % len( | ||
| 164 | - extension_data) | ||
| 162 | + assert len(extension_data) > 19, "Index Footer was not at least a sha on content as it was only %i bytes in size"\ | ||
| 163 | + % len(extension_data) | ||
| 165 | 164 | ||
| 166 | 165 | content_sha = extension_data[-20:] | |
| 167 | 166 | ||
@@ -265,7 +264,7 @@ def aggressive_tree_merge(odb, tree_shas): | |||
| 265 | 264 | # it exists in all branches, if it was changed in both | |
| 266 | 265 | # its a conflict, otherwise we take the changed version | |
| 267 | 266 | # This should be the most common branch, so it comes first | |
| 268 | - if( base[0] != ours[0] and base[0] != theirs[0] and ours[0] != theirs[0] ) or \ | ||
| 267 | + if(base[0] != ours[0] and base[0] != theirs[0] and ours[0] != theirs[0]) or \ | ||
| 269 | 268 | (base[1] != ours[1] and base[1] != theirs[1] and ours[1] != theirs[1]): | |
| 270 | 269 | # changed by both | |
| 271 | 270 | out_append(_tree_entry_to_baseindexentry(base, 1)) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments