← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/pcj-repr into lp:launchpad

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/pcj-repr into lp:launchpad.

Commit message:
Improve representation of PPAs in PlainPackageCopyJob.__repr__.

Requested reviews:
  Celso Providelo (cprov)
Related bugs:
  Bug #812818 in Launchpad itself: "PackageCopyJob __repr__ doesn't show enough info"
  https://bugs.launchpad.net/launchpad/+bug/812818

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/pcj-repr/+merge/226009

Improve representation of PPAs in PlainPackageCopyJob.__repr__.

PPAs are now shown as "~owner/distribution/name".
-- 
https://code.launchpad.net/~cjwatson/launchpad/pcj-repr/+merge/226009
Your team Launchpad code reviewers is subscribed to branch lp:launchpad.
=== modified file 'lib/lp/soyuz/model/packagecopyjob.py'
--- lib/lp/soyuz/model/packagecopyjob.py	2014-05-15 08:49:44 +0000
+++ lib/lp/soyuz/model/packagecopyjob.py	2014-07-09 08:20:47 +0000
@@ -740,18 +740,12 @@
             parts.append(" no package (!)")
         else:
             parts.append(" package %s" % self.package_name)
-        parts.append(
-            " from %s/%s" % (
-                self.source_archive.distribution.name,
-                self.source_archive.name))
+        parts.append(" from %s" % self.source_archive.reference)
         if self.source_pocket is not None:
             parts.append(", %s pocket," % self.source_pocket.name)
         if self.source_distroseries is not None:
             parts.append(" in %s" % self.source_distroseries)
-        parts.append(
-            " to %s/%s" % (
-                self.target_archive.distribution.name,
-                self.target_archive.name))
+        parts.append(" to %s" % self.target_archive.reference)
         parts.append(", %s pocket," % self.target_pocket.name)
         if self.target_distroseries is not None:
             parts.append(" in %s" % self.target_distroseries)

=== modified file 'lib/lp/soyuz/tests/test_packagecopyjob.py'
--- lib/lp/soyuz/tests/test_packagecopyjob.py	2014-07-08 06:34:37 +0000
+++ lib/lp/soyuz/tests/test_packagecopyjob.py	2014-07-09 08:20:47 +0000
@@ -593,8 +593,11 @@
 
     def test___repr__(self):
         distroseries = self.factory.makeDistroSeries()
-        archive1 = self.factory.makeArchive(distroseries.distribution)
-        archive2 = self.factory.makeArchive(distroseries.distribution)
+        owner = self.factory.makePerson()
+        archive1 = self.factory.makeArchive(
+            distribution=distroseries.distribution, owner=owner)
+        archive2 = self.factory.makeArchive(
+            distribution=distroseries.distribution, owner=owner)
         requester = self.factory.makePerson()
         source = getUtility(IPlainPackageCopyJobSource)
         job = source.create(
@@ -605,12 +608,13 @@
             requester=requester)
         self.assertEqual(
             ("<PlainPackageCopyJob to copy package foo from "
-             "{distroseries.distribution.name}/{archive1.name} to "
-             "{distroseries.distribution.name}/{archive2.name}, "
-             "RELEASE pocket, in {distroseries.distribution.name} "
-             "{distroseries.name}, including binaries>").format(
-                distroseries=distroseries, archive1=archive1,
-                archive2=archive2),
+             "~{owner.name}/{distribution.name}/{archive1.name} to "
+             "~{owner.name}/{distribution.name}/{archive2.name}, "
+             "RELEASE pocket, in {distribution.name} {distroseries.name}, "
+             "including binaries>").format(
+                owner=owner, distribution=distroseries.distribution,
+                archive1=archive1, archive2=archive2,
+                distroseries=distroseries),
             repr(job))
 
     def test_getPendingJobsPerPackage_finds_jobs(self):


Follow ups