| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -17,9 +17,17 @@ Changelog | |||
| 17 | 17 | * ``set_commit(...)`` method added (reflog support) | |
| 18 | 18 | * ``set_object(...)`` method added (reflog support) | |
| 19 | 19 | ||
| 20 | - * Intrusive Changes to ``Head`` type | ||
| 20 | + * **Intrusive Changes** to ``Head`` type | ||
| 21 | 21 | ||
| 22 | 22 | * ``create(...)`` method now supports the reflog, but will not raise ``GitCommandError`` anymore as it is a pure python implementation now. Instead, it raises ``OSError``. | |
| 23 | + | ||
| 24 | + * **Intrusive Changes** to ``Actor`` type | ||
| 25 | + | ||
| 26 | + * the *name* field is now using unicode if ascii does not match | ||
| 27 | + | ||
| 28 | + * **Intrusive Changes** to ``Repo`` type | ||
| 29 | + | ||
| 30 | + * ``create_head(...)`` method does not support **kwargs anymore, instead it supports a logmsg parameter | ||
| 23 | 31 | ||
| 24 | 32 | * Repo.rev_parse now supports the [ref]@{n} syntax, where n is the number of steps to look into the reference's past | |
| 25 | 33 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -350,12 +350,12 @@ def create_from_tree(cls, repo, tree, message, parent_commits=None, head=False): | |||
| 350 | 350 | # as well ... | |
| 351 | 351 | import git.refs | |
| 352 | 352 | try: | |
| 353 | - repo.head.commit = new_commit | ||
| 353 | + repo.head.set_commit(new_commit, logmsg="commit: %s" % message) | ||
| 354 | 354 | except ValueError: | |
| 355 | 355 | # head is not yet set to the ref our HEAD points to | |
| 356 | 356 | # Happens on first commit | |
| 357 | 357 | import git.refs | |
| 358 | - master = git.refs.Head.create(repo, repo.head.ref, commit=new_commit) | ||
| 358 | + master = git.refs.Head.create(repo, repo.head.ref, commit=new_commit, logmsg="commit (initial): %s" % message) | ||
| 359 | 359 | repo.head.reference = master | |
| 360 | 360 | # END handle empty repositories | |
| 361 | 361 | # END advance head handling | |
@@ -382,7 +382,12 @@ def _serialize(self, stream): | |||
| 382 | 382 | self.authored_date, | |
| 383 | 383 | altz_to_utctz_str(self.author_tz_offset))) | |
| 384 | 384 | ||
| 385 | - write(fmt % ("committer", c.name, c.email, | ||
| 385 | + # encode committer | ||
| 386 | + aname = c.name | ||
| 387 | + if isinstance(aname, unicode): | ||
| 388 | + aname = aname.encode(self.encoding) | ||
| 389 | + # END handle unicode in name | ||
| 390 | + write(fmt % ("committer", aname, c.email, | ||
| 386 | 391 | self.committed_date, | |
| 387 | 392 | altz_to_utctz_str(self.committer_tz_offset))) | |
| 388 | 393 | ||
@@ -440,6 +445,13 @@ def _deserialize(self, stream): | |||
| 440 | 445 | print >> sys.stderr, "Failed to decode author name '%s' using encoding %s" % (self.author.name, self.encoding) | |
| 441 | 446 | # END handle author's encoding | |
| 442 | 447 | ||
| 448 | + # decode committer name | ||
| 449 | + try: | ||
| 450 | + self.committer.name = self.committer.name.decode(self.encoding) | ||
| 451 | + except UnicodeDecodeError: | ||
| 452 | + print >> sys.stderr, "Failed to decode committer name '%s' using encoding %s" % (self.committer.name, self.encoding) | ||
| 453 | + # END handle author's encoding | ||
| 454 | + | ||
| 443 | 455 | # a stream from our data simply gives us the plain message | |
| 444 | 456 | # The end of our message stream is marked with a newline that we strip | |
| 445 | 457 | self.message = stream.read() | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -207,12 +207,8 @@ def update(self, previous_commit=None, recursive=True, force_remove=False, init= | |||
| 207 | 207 | smm = sm.module() | |
| 208 | 208 | smmr = smm.remotes | |
| 209 | 209 | try: | |
| 210 | - tbr = git.Head.create(smm, sm.branch_name) | ||
| 211 | - except git.GitCommandError, e: | ||
| 212 | - if e.status != 128: | ||
| 213 | - raise | ||
| 214 | - #END handle something unexpected | ||
| 215 | - | ||
| 210 | + tbr = git.Head.create(smm, sm.branch_name, logmsg='branch: Created from HEAD') | ||
| 211 | + except OSError: | ||
| 216 | 212 | # ... or reuse the existing one | |
| 217 | 213 | tbr = git.Head(smm, sm.branch_path) | |
| 218 | 214 | #END assure tracking branch exists | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -274,12 +274,12 @@ def tag(self,path): | |||
| 274 | 274 | :param path: path to the tag reference, i.e. 0.1.5 or tags/0.1.5 """ | |
| 275 | 275 | return TagReference(self, path) | |
| 276 | 276 | ||
| 277 | - def create_head(self, path, commit='HEAD', force=False, **kwargs ): | ||
| 277 | + def create_head(self, path, commit='HEAD', force=False, logmsg=None ): | ||
| 278 | 278 | """Create a new head within the repository. | |
| 279 | 279 | For more documentation, please see the Head.create method. | |
| 280 | 280 | ||
| 281 | 281 | :return: newly created Head Reference""" | |
| 282 | - return Head.create(self, path, commit, force, **kwargs) | ||
| 282 | + return Head.create(self, path, commit, force, logmsg) | ||
| 283 | 283 | ||
| 284 | 284 | def delete_head(self, *heads, **kwargs): | |
| 285 | 285 | """Delete the given heads | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -112,7 +112,9 @@ def rev_parse(repo, rev): | |||
| 112 | 112 | for details | |
| 113 | 113 | :note: Currently there is no access to the rev-log, rev-specs may only contain | |
| 114 | 114 | topological tokens such ~ and ^. | |
| 115 | - :raise BadObject: if the given revision could not be found""" | ||
| 115 | + :raise BadObject: if the given revision could not be found | ||
| 116 | + :raise ValueError: If rev couldn't be parsed | ||
| 117 | + :raise IndexError: If invalid reflog index is specified""" | ||
| 116 | 118 | ||
| 117 | 119 | # colon search mode ? | |
| 118 | 120 | if rev.startswith(':/'): | |
@@ -193,7 +195,7 @@ def rev_parse(repo, rev): | |||
| 193 | 195 | try: | |
| 194 | 196 | entry = ref.log_entry(revlog_index) | |
| 195 | 197 | except IndexError: | |
| 196 | - raise BadObject("Invalid revlog index: %i" % revlog_index) | ||
| 198 | + raise IndexError("Invalid revlog index: %i" % revlog_index) | ||
| 197 | 199 | #END handle index out of bound | |
| 198 | 200 | ||
| 199 | 201 | obj = Object.new_from_sha(repo, hex_to_bin(entry.newhexsha)) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments