Skip to content

Commit 778234d

Browse files
committed
Merge branch 'writetree'
2 parents 91725f0 + c4f49fb commit 778234d

File tree

15 files changed

+515
-347
lines changed

15 files changed

+515
-347
lines changed

CHANGES

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ CHANGES
44
0.3
55
===
66
* ConcurrentWriteOperation was removed, and replaced by LockedFD
7+
* IndexFile.get_entries_key was renamed to entry_key
8+
* IndexEntry instances contained in IndexFile.entries now use binary sha's. Use
9+
the .hexsha property to obtain the hexadecimal version
10+
* IndexFile.write_tree: removed missing_ok keyword, its always True now
11+
Instead of raising GitCommandError it raises UnmergedEntriesError
12+
* diff.Diff.null_hex_sha renamed to NULL_HEX_SHA, to be conforming with
13+
the naming in the Object base class
14+
715

816
0.2 Beta 2
917
===========

lib/git/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def _init_externals():
2828
from git.objects import *
2929
from git.refs import *
3030
from git.diff import *
31-
from git.errors import InvalidGitRepositoryError, NoSuchPathError, GitCommandError
31+
from git.errors import *
3232
from git.cmd import Git
3333
from git.repo import Repo
3434
from git.remote import *

lib/git/db.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@
44
OStream
55
)
66

7+
from gitdb.util import to_hex_sha
8+
79
from gitdb.db import GitDB
810
from gitdb.db import LooseObjectDB
911

12+
1013
__all__ = ('GitCmdObjectDB', 'GitDB' )
1114

1215
#class GitCmdObjectDB(CompoundDB, ObjectDBW):
@@ -24,11 +27,11 @@ def __init__(self, root_path, git):
2427
self._git = git
2528

2629
def info(self, sha):
27-
t = self._git.get_object_header(sha)
30+
t = self._git.get_object_header(to_hex_sha(sha))
2831
return OInfo(*t)
2932

3033
def stream(self, sha):
3134
"""For now, all lookup is done by git itself"""
32-
t = self._git.stream_object_data(sha)
35+
t = self._git.stream_object_data(to_hex_sha(sha))
3336
return OStream(*t)
3437

lib/git/diff.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ class Diff(object):
196196
\.\.(?P<b_blob_id>[0-9A-Fa-f]+)[ ]?(?P<b_mode>.+)?(?:\n|$))?
197197
""", re.VERBOSE | re.MULTILINE)
198198
# can be used for comparisons
199-
null_hex_sha = "0"*40
199+
NULL_HEX_SHA = "0"*40
200200

201201
__slots__ = ("a_blob", "b_blob", "a_mode", "b_mode", "new_file", "deleted_file",
202202
"rename_from", "rename_to", "diff")

lib/git/errors.py

Lines changed: 39 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,43 +6,51 @@
66
""" Module containing all exceptions thrown througout the git package, """
77

88
class InvalidGitRepositoryError(Exception):
9-
""" Thrown if the given repository appears to have an invalid format. """
9+
""" Thrown if the given repository appears to have an invalid format. """
1010

1111

1212
class NoSuchPathError(OSError):
13-
""" Thrown if a path could not be access by the system. """
13+
""" Thrown if a path could not be access by the system. """
1414

1515

1616
class GitCommandError(Exception):
17-
""" Thrown if execution of the git command fails with non-zero status code. """
18-
def __init__(self, command, status, stderr=None):
19-
self.stderr = stderr
20-
self.status = status
21-
self.command = command
22-
23-
def __str__(self):
24-
return ("'%s' returned exit status %i: %s" %
25-
(' '.join(str(i) for i in self.command), self.status, self.stderr))
17+
""" Thrown if execution of the git command fails with non-zero status code. """
18+
def __init__(self, command, status, stderr=None):
19+
self.stderr = stderr
20+
self.status = status
21+
self.command = command
22+
23+
def __str__(self):
24+
return ("'%s' returned exit status %i: %s" %
25+
(' '.join(str(i) for i in self.command), self.status, self.stderr))
2626

2727

2828
class CheckoutError( Exception ):
29-
"""Thrown if a file could not be checked out from the index as it contained
30-
changes.
31-
32-
The .failed_files attribute contains a list of relative paths that failed
33-
to be checked out as they contained changes that did not exist in the index.
34-
35-
The .failed_reasons attribute contains a string informing about the actual
36-
cause of the issue.
37-
38-
The .valid_files attribute contains a list of relative paths to files that
39-
were checked out successfully and hence match the version stored in the
40-
index"""
41-
def __init__(self, message, failed_files, valid_files, failed_reasons):
42-
Exception.__init__(self, message)
43-
self.failed_files = failed_files
44-
self.failed_reasons = failed_reasons
45-
self.valid_files = valid_files
46-
47-
def __str__(self):
48-
return Exception.__str__(self) + ":%s" % self.failed_files
29+
"""Thrown if a file could not be checked out from the index as it contained
30+
changes.
31+
32+
The .failed_files attribute contains a list of relative paths that failed
33+
to be checked out as they contained changes that did not exist in the index.
34+
35+
The .failed_reasons attribute contains a string informing about the actual
36+
cause of the issue.
37+
38+
The .valid_files attribute contains a list of relative paths to files that
39+
were checked out successfully and hence match the version stored in the
40+
index"""
41+
def __init__(self, message, failed_files, valid_files, failed_reasons):
42+
Exception.__init__(self, message)
43+
self.failed_files = failed_files
44+
self.failed_reasons = failed_reasons
45+
self.valid_files = valid_files
46+
47+
def __str__(self):
48+
return Exception.__str__(self) + ":%s" % self.failed_files
49+
50+
51+
class CacheError(Exception):
52+
"""Base for all errors related to the git index, which is called cache internally"""
53+
54+
class UnmergedEntriesError(CacheError):
55+
"""Thrown if an operation cannot proceed as there are still unmerged
56+
entries in the cache"""

lib/git/ext/gitdb

Submodule gitdb updated from 92ca2e4 to 9b53ab0

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy