| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 0b820e6 commit b789ebc
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -57,12 +57,12 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable): | |||
| 57 | 57 | __slots__ = ("tree", | |
| 58 | 58 | "author", "authored_date", "author_tz_offset", | |
| 59 | 59 | "committer", "committed_date", "committer_tz_offset", | |
| 60 | - "message", "parents", "encoding") | ||
| 60 | + "message", "parents", "encoding", "gpgsig") | ||
| 61 | 61 | _id_attribute_ = "binsha" | |
| 62 | 62 | ||
| 63 | 63 | def __init__(self, repo, binsha, tree=None, author=None, authored_date=None, author_tz_offset=None, | |
| 64 | 64 | committer=None, committed_date=None, committer_tz_offset=None, | |
| 65 | - message=None, parents=None, encoding=None): | ||
| 65 | + message=None, parents=None, encoding=None, gpgsig=None): | ||
| 66 | 66 | """Instantiate a new Commit. All keyword arguments taking None as default will | |
| 67 | 67 | be implicitly set on first query. | |
| 68 | 68 | ||
@@ -120,6 +120,7 @@ def __init__(self, repo, binsha, tree=None, author=None, authored_date=None, aut | |||
| 120 | 120 | self.parents = parents | |
| 121 | 121 | if encoding is not None: | |
| 122 | 122 | self.encoding = encoding | |
| 123 | + self.gpgsig = gpgsig | ||
| 123 | 124 | ||
| 124 | 125 | @classmethod | |
| 125 | 126 | def _get_intermediate_items(cls, commit): | |
@@ -393,6 +394,12 @@ def _serialize(self, stream): | |||
| 393 | 394 | ||
| 394 | 395 | if self.encoding != self.default_encoding: | |
| 395 | 396 | write("encoding %s\n" % self.encoding) | |
| 397 | + | ||
| 398 | + if self.gpgsig: | ||
| 399 | + write("gpgsig") | ||
| 400 | + for sigline in self.gpgsig.split("\n"): | ||
| 401 | + write(" " + sigline + "\n") | ||
| 402 | + | ||
| 396 | 403 | ||
| 397 | 404 | write("\n") | |
| 398 | 405 | ||
@@ -430,13 +437,28 @@ def _deserialize(self, stream): | |||
| 430 | 437 | # message. | |
| 431 | 438 | self.encoding = self.default_encoding | |
| 432 | 439 | # read encoding or empty line to separate message | |
| 433 | - enc = readline() | ||
| 434 | - enc = enc.strip() | ||
| 435 | - if enc: | ||
| 436 | - self.encoding = enc[enc.find(' ')+1:] | ||
| 437 | - # now comes the message separator | ||
| 438 | - readline() | ||
| 439 | - # END handle encoding | ||
| 440 | + | ||
| 441 | + # read headers | ||
| 442 | + buf = readline().strip() | ||
| 443 | + while buf != "": | ||
| 444 | + if buf[0:10] == "encoding ": | ||
| 445 | + self.encoding = buf[buf.find(' ')+1:] | ||
| 446 | + elif buf[0:7] == "gpgsig ": | ||
| 447 | + sig = buf[buf.find(' ')+1:] + "\n" | ||
| 448 | + is_next_header = False | ||
| 449 | + while True: | ||
| 450 | + sigbuf = readline() | ||
| 451 | + if sigbuf == "": break | ||
| 452 | + if sigbuf[0:1] != " ": | ||
| 453 | + buf = sigbuf.strip() | ||
| 454 | + is_next_header = True | ||
| 455 | + break | ||
| 456 | + sig += sigbuf[1:] | ||
| 457 | + self.gpgsig = sig | ||
| 458 | + if is_next_header: | ||
| 459 | + continue | ||
| 460 | + buf = readline().strip() | ||
| 461 | + | ||
| 440 | 462 | ||
| 441 | 463 | # decode the authors name | |
| 442 | 464 | try: | |
| Back | FazBrowse Home | New Git URL |
0 commit comments