Kiln » Dependencies » Dulwich Read More
Clone URL:  
Pushed to one repository · View In Graph Contained in master-1, master-0, and 0.9.4

Support author/committer timezones.

Changeset da8b3da61f46

Parent daf8a449df27

by Jelmer Vernooij

Changes to 3 files · Browse files at da8b3da61f46 Showing diff from parent daf8a449df27 Diff from another changeset...

 
295
296
297
 
 
298
299
 
295
296
297
298
299
300
301
@@ -295,5 +295,7 @@
  obj = object_store[sha]   if type(obj) is not Tree:   raise NotTreeError(sha) + if p == '': + continue   mode, sha = obj[p]   return object_store[sha]
 
435
436
437
 
 
 
438
 
 
 
 
439
440
441
 
456
457
458
 
 
 
 
459
460
461
 
469
470
471
472
473
 
 
474
475
476
 
508
509
510
 
 
 
 
 
 
511
512
513
 
515
516
517
 
 
 
 
 
518
519
520
 
435
436
437
438
439
440
441
442
443
444
445
446
447
448
 
463
464
465
466
467
468
469
470
471
472
 
480
481
482
 
 
483
484
485
486
487
 
519
520
521
522
523
524
525
526
527
528
529
530
 
532
533
534
535
536
537
538
539
540
541
542
@@ -435,7 +435,14 @@
  count += 1   self._author += text[count]   count += 1 + assert text[count] == ' ', "Invalid commit object, " \ + "author information must be followed by space not %s" % text[count] + count += 1   self._author_time = int(text[count:count+10]) + while text[count] != ' ': + count += 1 + self._author_timezone = int(text[count:count+6]) + count += 1   while text[count] != '\n':   count += 1   count += 1 @@ -456,6 +463,10 @@
  "commiter information must be followed by space not %s" % text[count]   count += 1   self._commit_time = int(text[count:count+10]) + while text[count] != ' ': + count += 1 + self._commit_timezone = int(text[count:count+6]) + count += 1   while text[count] != '\n':   count += 1   count += 1 @@ -469,8 +480,8 @@
  self._text += "%s %s\n" % (TREE_ID, self._tree)   for p in self._parents:   self._text += "%s %s\n" % (PARENT_ID, p) - self._text += "%s %s %s +0000\n" % (AUTHOR_ID, self._author, str(self._author_time)) - self._text += "%s %s %s +0000\n" % (COMMITTER_ID, self._committer, str(self._commit_time)) + self._text += "%s %s %s %+05d\n" % (AUTHOR_ID, self._author, str(self._author_time), self._author_timezone) + self._text += "%s %s %s %+05d\n" % (COMMITTER_ID, self._committer, str(self._commit_time), self._commit_timezone)   self._text += "\n" # There must be a new line after the headers   self._text += self._message   @@ -508,6 +519,12 @@
  return self._commit_time     @property + def commit_timezone(self): + """Returns the zone the commit time is in + """ + return self._commit_timezone + + @property   def author_time(self):   """Returns the timestamp the commit was written.   @@ -515,6 +532,11 @@
  """   return self._author_time   + @property + def author_timezone(self): + """Returns the zone the author time is in + """ + return self._author_timezone      type_map = {
 
105
106
107
 
 
108
109
110
 
117
118
119
 
 
120
121
122
 
130
131
132
 
 
133
134
 
105
106
107
108
109
110
111
112
 
119
120
121
122
123
124
125
126
 
134
135
136
137
138
139
140
@@ -105,6 +105,8 @@
  self.assertEqual(c.committer,   'James Westby <jw+debian@jameswestby.net>')   self.assertEqual(c.commit_time, 1174759230) + self.assertEqual(c.commit_timezone, 0) + self.assertEqual(c.author_timezone, 0)   self.assertEqual(c.message, 'Test commit\n')     def test_read_commit_no_parents(self): @@ -117,6 +119,8 @@
  self.assertEqual(c.committer,   'James Westby <jw+debian@jameswestby.net>')   self.assertEqual(c.commit_time, 1174758034) + self.assertEqual(c.commit_timezone, 0) + self.assertEqual(c.author_timezone, 0)   self.assertEqual(c.message, 'Test commit\n')     def test_read_commit_two_parents(self): @@ -130,5 +134,7 @@
  self.assertEqual(c.committer,   'James Westby <jw+debian@jameswestby.net>')   self.assertEqual(c.commit_time, 1174773719) + self.assertEqual(c.commit_timezone, 0) + self.assertEqual(c.author_timezone, 0)   self.assertEqual(c.message, 'Merge ../b\n')