Merge lp:~cjwatson/python-oops-tools/add-git-support into lp:python-oops-tools

Proposed by Colin Watson on 2016-09-14
Status: Merged
Approved by: Colin Watson on 2019-01-23
Approved revision: 56
Merged at revision: 58
Proposed branch: lp:~cjwatson/python-oops-tools/add-git-support
Merge into: lp:python-oops-tools
Diff against target: 52 lines (+8/-5)
3 files modified
src/oopstools/oops/models.py (+6/-3)
src/oopstools/oops/templates/oops.html (+1/-1)
src/oopstools/oops/test/oops.txt (+1/-1)
To merge this branch: bzr merge lp:~cjwatson/python-oops-tools/add-git-support
Reviewer Review Type Date Requested Status
William Grant code 2016-09-14 Approve on 2018-05-08
Review via email: mp+305726@code.launchpad.net

Commit message

Adjust revision handling to cope with projects that use git.

Description of the change

"revno" is a bit bzr-specific, and Launchpad itself will be switching to git soon. Accept "revision" in oopses instead and expect it to be a character field, but continue to tolerate oopses that use "revno".

To post a comment you must log in.
William Grant (wgrant) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/oopstools/oops/models.py'
--- src/oopstools/oops/models.py 2013-02-25 21:41:12 +0000
+++ src/oopstools/oops/models.py 2016-09-14 15:55:28 +0000
@@ -518,7 +518,7 @@
518 most_expensive_statement = models.CharField(518 most_expensive_statement = models.CharField(
519 max_length=200, null=True, db_index=True)519 max_length=200, null=True, db_index=True)
520 branch_nick = models.CharField(max_length=200, null=True)520 branch_nick = models.CharField(max_length=200, null=True)
521 revno = models.PositiveIntegerField(null=True)521 revision = models.CharField(max_length=40, null=True)
522 total_time = models.PositiveIntegerField()522 total_time = models.PositiveIntegerField()
523 time_is_estimate = models.NullBooleanField()523 time_is_estimate = models.NullBooleanField()
524 informational = models.NullBooleanField()524 informational = models.NullBooleanField()
@@ -537,8 +537,11 @@
537 return self.parsed_oops.get('branch_nick', 'Unknown') or 'Unknown'537 return self.parsed_oops.get('branch_nick', 'Unknown') or 'Unknown'
538538
539 @property539 @property
540 def revno(self):540 def revision(self):
541 return self.parsed_oops.get('revno', 'Unknown')541 if 'revision' in self.parsed_oops:
542 return self.parsed_oops['revision']
543 else:
544 return self.parsed_oops.get('revno', 'Unknown')
542545
543 @property546 @property
544 def userdata(self):547 def userdata(self):
545548
=== modified file 'src/oopstools/oops/templates/oops.html'
--- src/oopstools/oops/templates/oops.html 2011-11-16 23:21:38 +0000
+++ src/oopstools/oops/templates/oops.html 2016-09-14 15:55:28 +0000
@@ -59,7 +59,7 @@
59 </div>59 </div>
60 <div id="branch">60 <div id="branch">
61 <li>Branch: <span>{{ oops.branch_nick }}</span></li>61 <li>Branch: <span>{{ oops.branch_nick }}</span></li>
62 <li>Revno: <span>{{ oops.revno }}</span></li>62 <li>Revision: <span>{{ oops.revision }}</span></li>
63 </div>63 </div>
64 <div id="database">64 <div id="database">
65 <li>SQL time: <span>{{ oops.accumulated_time }}</span> ms</li>65 <li>SQL time: <span>{{ oops.accumulated_time }}</span> ms</li>
6666
=== modified file 'src/oopstools/oops/test/oops.txt'
--- src/oopstools/oops/test/oops.txt 2011-11-16 07:43:57 +0000
+++ src/oopstools/oops/test/oops.txt 2016-09-14 15:55:28 +0000
@@ -41,7 +41,7 @@
4141
42The branch revision number.42The branch revision number.
4343
44 >>> print oops.revno44 >>> print oops.revision
45 520445 5204
4646
47The logged in user, if any, at the time the error occurred.47The logged in user, if any, at the time the error occurred.

Subscribers

People subscribed via source and target branches

to all changes: