summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/source/changes.rst10
-rw-r--r--objects/commit.py18
-rw-r--r--objects/submodule/root.py8
-rw-r--r--repo/base.py4
-rw-r--r--repo/fun.py6
5 files changed, 32 insertions, 14 deletions
diff --git a/doc/source/changes.rst b/doc/source/changes.rst
index 7b959532..d820c8ca 100644
--- a/doc/source/changes.rst
+++ b/doc/source/changes.rst
@@ -17,9 +17,17 @@ Changelog
* ``set_commit(...)`` method added (reflog support)
* ``set_object(...)`` method added (reflog support)
- * Intrusive Changes to ``Head`` type
+ * **Intrusive Changes** to ``Head`` type
* ``create(...)`` method now supports the reflog, but will not raise ``GitCommandError`` anymore as it is a pure python implementation now. Instead, it raises ``OSError``.
+
+ * **Intrusive Changes** to ``Actor`` type
+
+ * the *name* field is now using unicode if ascii does not match
+
+ * **Intrusive Changes** to ``Repo`` type
+
+ * ``create_head(...)`` method does not support **kwargs anymore, instead it supports a logmsg parameter
* Repo.rev_parse now supports the [ref]@{n} syntax, where n is the number of steps to look into the reference's past
diff --git a/objects/commit.py b/objects/commit.py
index 9c7e66a3..883d6a6c 100644
--- a/objects/commit.py
+++ b/objects/commit.py
@@ -350,12 +350,12 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable):
# as well ...
import git.refs
try:
- repo.head.commit = new_commit
+ repo.head.set_commit(new_commit, logmsg="commit: %s" % message)
except ValueError:
# head is not yet set to the ref our HEAD points to
# Happens on first commit
import git.refs
- master = git.refs.Head.create(repo, repo.head.ref, commit=new_commit)
+ master = git.refs.Head.create(repo, repo.head.ref, commit=new_commit, logmsg="commit (initial): %s" % message)
repo.head.reference = master
# END handle empty repositories
# END advance head handling
@@ -382,7 +382,12 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable):
self.authored_date,
altz_to_utctz_str(self.author_tz_offset)))
- write(fmt % ("committer", c.name, c.email,
+ # encode committer
+ aname = c.name
+ if isinstance(aname, unicode):
+ aname = aname.encode(self.encoding)
+ # END handle unicode in name
+ write(fmt % ("committer", aname, c.email,
self.committed_date,
altz_to_utctz_str(self.committer_tz_offset)))
@@ -440,6 +445,13 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable):
print >> sys.stderr, "Failed to decode author name '%s' using encoding %s" % (self.author.name, self.encoding)
# END handle author's encoding
+ # decode committer name
+ try:
+ self.committer.name = self.committer.name.decode(self.encoding)
+ except UnicodeDecodeError:
+ print >> sys.stderr, "Failed to decode committer name '%s' using encoding %s" % (self.committer.name, self.encoding)
+ # END handle author's encoding
+
# a stream from our data simply gives us the plain message
# The end of our message stream is marked with a newline that we strip
self.message = stream.read()
diff --git a/objects/submodule/root.py b/objects/submodule/root.py
index d194cd5b..ca51b34e 100644
--- a/objects/submodule/root.py
+++ b/objects/submodule/root.py
@@ -207,12 +207,8 @@ class RootModule(Submodule):
smm = sm.module()
smmr = smm.remotes
try:
- tbr = git.Head.create(smm, sm.branch_name)
- except git.GitCommandError, e:
- if e.status != 128:
- raise
- #END handle something unexpected
-
+ tbr = git.Head.create(smm, sm.branch_name, logmsg='branch: Created from HEAD')
+ except OSError:
# ... or reuse the existing one
tbr = git.Head(smm, sm.branch_path)
#END assure tracking branch exists
diff --git a/repo/base.py b/repo/base.py
index c8613878..e26da101 100644
--- a/repo/base.py
+++ b/repo/base.py
@@ -274,12 +274,12 @@ class Repo(object):
:param path: path to the tag reference, i.e. 0.1.5 or tags/0.1.5 """
return TagReference(self, path)
- def create_head(self, path, commit='HEAD', force=False, **kwargs ):
+ def create_head(self, path, commit='HEAD', force=False, logmsg=None ):
"""Create a new head within the repository.
For more documentation, please see the Head.create method.
:return: newly created Head Reference"""
- return Head.create(self, path, commit, force, **kwargs)
+ return Head.create(self, path, commit, force, logmsg)
def delete_head(self, *heads, **kwargs):
"""Delete the given heads
diff --git a/repo/fun.py b/repo/fun.py
index c523a3e1..7a5984d3 100644
--- a/repo/fun.py
+++ b/repo/fun.py
@@ -112,7 +112,9 @@ def rev_parse(repo, rev):
for details
:note: Currently there is no access to the rev-log, rev-specs may only contain
topological tokens such ~ and ^.
- :raise BadObject: if the given revision could not be found"""
+ :raise BadObject: if the given revision could not be found
+ :raise ValueError: If rev couldn't be parsed
+ :raise IndexError: If invalid reflog index is specified"""
# colon search mode ?
if rev.startswith(':/'):
@@ -193,7 +195,7 @@ def rev_parse(repo, rev):
try:
entry = ref.log_entry(revlog_index)
except IndexError:
- raise BadObject("Invalid revlog index: %i" % revlog_index)
+ raise IndexError("Invalid revlog index: %i" % revlog_index)
#END handle index out of bound
obj = Object.new_from_sha(repo, hex_to_bin(entry.newhexsha))