← Back to team overview

launchpad-reviewers team mailing list archive

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

 

Colin Watson has proposed merging lp:~cjwatson/python-oops-tools/add-git-support into lp:python-oops-tools.

Commit message:
Adjust revision handling to cope with projects that use git.

Requested reviews:
  python-oops-tools reviewers (oops-tools-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/python-oops-tools/add-git-support/+merge/305726

"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".
-- 
Your team python-oops-tools reviewers is requested to review the proposed merge of lp:~cjwatson/python-oops-tools/add-git-support into lp:python-oops-tools.
=== 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 @@
     most_expensive_statement = models.CharField(
         max_length=200, null=True, db_index=True)
     branch_nick = models.CharField(max_length=200, null=True)
-    revno = models.PositiveIntegerField(null=True)
+    revision = models.CharField(max_length=40, null=True)
     total_time = models.PositiveIntegerField()
     time_is_estimate = models.NullBooleanField()
     informational = models.NullBooleanField()
@@ -537,8 +537,11 @@
         return self.parsed_oops.get('branch_nick', 'Unknown') or 'Unknown'
 
     @property
-    def revno(self):
-        return self.parsed_oops.get('revno', 'Unknown')
+    def revision(self):
+        if 'revision' in self.parsed_oops:
+            return self.parsed_oops['revision']
+        else:
+            return self.parsed_oops.get('revno', 'Unknown')
 
     @property
     def userdata(self):

=== 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 @@
   </div>
   <div id="branch">
     <li>Branch: <span>{{ oops.branch_nick }}</span></li>
-    <li>Revno: <span>{{ oops.revno }}</span></li>
+    <li>Revision: <span>{{ oops.revision }}</span></li>
   </div>
   <div id="database">
     <li>SQL time: <span>{{ oops.accumulated_time }}</span> ms</li>

=== 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 @@
 
 The branch revision number.
 
-    >>> print oops.revno
+    >>> print oops.revision
     5204
 
 The logged in user, if any, at the time the error occurred.