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
1=== modified file 'src/oopstools/oops/models.py'
2--- src/oopstools/oops/models.py 2013-02-25 21:41:12 +0000
3+++ src/oopstools/oops/models.py 2016-09-14 15:55:28 +0000
4@@ -518,7 +518,7 @@
5 most_expensive_statement = models.CharField(
6 max_length=200, null=True, db_index=True)
7 branch_nick = models.CharField(max_length=200, null=True)
8- revno = models.PositiveIntegerField(null=True)
9+ revision = models.CharField(max_length=40, null=True)
10 total_time = models.PositiveIntegerField()
11 time_is_estimate = models.NullBooleanField()
12 informational = models.NullBooleanField()
13@@ -537,8 +537,11 @@
14 return self.parsed_oops.get('branch_nick', 'Unknown') or 'Unknown'
15
16 @property
17- def revno(self):
18- return self.parsed_oops.get('revno', 'Unknown')
19+ def revision(self):
20+ if 'revision' in self.parsed_oops:
21+ return self.parsed_oops['revision']
22+ else:
23+ return self.parsed_oops.get('revno', 'Unknown')
24
25 @property
26 def userdata(self):
27
28=== modified file 'src/oopstools/oops/templates/oops.html'
29--- src/oopstools/oops/templates/oops.html 2011-11-16 23:21:38 +0000
30+++ src/oopstools/oops/templates/oops.html 2016-09-14 15:55:28 +0000
31@@ -59,7 +59,7 @@
32 </div>
33 <div id="branch">
34 <li>Branch: <span>{{ oops.branch_nick }}</span></li>
35- <li>Revno: <span>{{ oops.revno }}</span></li>
36+ <li>Revision: <span>{{ oops.revision }}</span></li>
37 </div>
38 <div id="database">
39 <li>SQL time: <span>{{ oops.accumulated_time }}</span> ms</li>
40
41=== modified file 'src/oopstools/oops/test/oops.txt'
42--- src/oopstools/oops/test/oops.txt 2011-11-16 07:43:57 +0000
43+++ src/oopstools/oops/test/oops.txt 2016-09-14 15:55:28 +0000
44@@ -41,7 +41,7 @@
45
46 The branch revision number.
47
48- >>> print oops.revno
49+ >>> print oops.revision
50 5204
51
52 The logged in user, if any, at the time the error occurred.

Subscribers

People subscribed via source and target branches

to all changes: