launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #04842
[Merge] lp:~stevenk/launchpad/no-more-staticdiff into lp:launchpad
Steve Kowalik has proposed merging lp:~stevenk/launchpad/no-more-staticdiff into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #834384 in Launchpad itself: "StaticDiff is unused and needs to be shot"
https://bugs.launchpad.net/launchpad/+bug/834384
For more details, see:
https://code.launchpad.net/~stevenk/launchpad/no-more-staticdiff/+merge/72830
StaticDiff has been unused since January 2010. It should be removed.
StaticDiffs (review_diff by the BranchMergeProposal parlance are *static* differences between two revisions of two branches. PreviewDiffs (merge_diff) are the diffs that update whenever each branch changes.
The code currently will check for a preview diff before falling back to a static diff, and there is a plan to migrate away from static diffs before this branch lands in the attached bug report.
--
https://code.launchpad.net/~stevenk/launchpad/no-more-staticdiff/+merge/72830
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/no-more-staticdiff into lp:launchpad.
=== modified file 'database/sampledata/current-dev.sql'
--- database/sampledata/current-dev.sql 2011-07-13 06:06:53 +0000
+++ database/sampledata/current-dev.sql 2011-08-26 00:48:47 +0000
@@ -3121,13 +3121,6 @@
ALTER TABLE previewdiff ENABLE TRIGGER ALL;
-ALTER TABLE staticdiff DISABLE TRIGGER ALL;
-
-
-
-ALTER TABLE staticdiff ENABLE TRIGGER ALL;
-
-
ALTER TABLE branchmergeproposal DISABLE TRIGGER ALL;
=== modified file 'database/sampledata/current.sql'
--- database/sampledata/current.sql 2011-07-13 06:06:53 +0000
+++ database/sampledata/current.sql 2011-08-26 00:48:47 +0000
@@ -3053,17 +3053,9 @@
ALTER TABLE previewdiff DISABLE TRIGGER ALL;
-
ALTER TABLE previewdiff ENABLE TRIGGER ALL;
-ALTER TABLE staticdiff DISABLE TRIGGER ALL;
-
-
-
-ALTER TABLE staticdiff ENABLE TRIGGER ALL;
-
-
ALTER TABLE branchmergeproposal DISABLE TRIGGER ALL;
=== modified file 'database/schema/security.cfg'
--- database/schema/security.cfg 2011-08-19 16:03:54 +0000
+++ database/schema/security.cfg 2011-08-26 00:48:47 +0000
@@ -307,7 +307,6 @@
public.sprintattendance = SELECT, INSERT, UPDATE, DELETE
public.sprintspecification = SELECT, INSERT, UPDATE, DELETE
public.standardshipitrequest = SELECT, INSERT, UPDATE, DELETE
-public.staticdiff = SELECT, INSERT, UPDATE
public.structuralsubscription = SELECT, INSERT, UPDATE, DELETE
public.subunitstream = SELECT, INSERT, UPDATE, DELETE
public.suggestivepotemplate = SELECT, INSERT, DELETE
@@ -666,7 +665,6 @@
public.sourcepackagerecipe = SELECT, UPDATE
public.sourcepackagerecipedata = SELECT
public.sourcepackagerecipedatainstruction = SELECT
-public.staticdiff = SELECT, INSERT, DELETE
public.structuralsubscription = SELECT
public.translationtemplatesbuild = SELECT, INSERT
public.validpersoncache = SELECT
@@ -1753,7 +1751,6 @@
public.sourcepackagerelease = SELECT
public.specification = SELECT
public.specificationsubscription = SELECT
-public.staticdiff = SELECT, INSERT, UPDATE
public.structuralsubscription = SELECT
public.teammembership = SELECT
public.teamparticipation = SELECT
@@ -1853,7 +1850,6 @@
public.project = SELECT
public.seriessourcepackagebranch = SELECT
public.sourcepackagename = SELECT
-public.staticdiff = SELECT, INSERT
public.teamparticipation = SELECT
public.validpersoncache = SELECT
type=user
@@ -1893,7 +1889,6 @@
public.revision = SELECT
public.seriessourcepackagebranch = SELECT
public.sourcepackagename = SELECT
-public.staticdiff = SELECT, INSERT
public.teammembership = SELECT
public.teamparticipation = SELECT
public.validpersoncache = SELECT
@@ -1939,7 +1934,6 @@
public.revisionauthor = SELECT, INSERT
public.seriessourcepackagebranch = SELECT
public.sourcepackagename = SELECT
-public.staticdiff = SELECT, INSERT
public.teammembership = SELECT
public.teamparticipation = SELECT
public.validpersoncache = SELECT
=== modified file 'lib/lp/code/browser/branchmergeproposal.py'
--- lib/lp/code/browser/branchmergeproposal.py 2011-08-05 18:45:24 +0000
+++ lib/lp/code/browser/branchmergeproposal.py 2011-08-26 00:48:47 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2010 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
# pylint: disable-msg=C0322,F0401
@@ -533,18 +533,16 @@
@cachedproperty
def diff_oversized(self):
- """Return True if the review_diff is over the configured size limit.
+ """Return True if the preview_diff is over the configured size limit.
The diff can be over the limit in two ways. If the diff is oversized
in bytes it will be cut off at the Diff.text method. If the number of
lines is over the max_format_lines, then it is cut off at the fmt:diff
processing.
"""
- review_diff = self.preview_diff
- if review_diff is None:
+ preview_diff = self.preview_diff
+ if preview_diff is None:
return False
- if review_diff.oversized:
- return True
diff_text = self.preview_diff_text
return diff_text.count('\n') >= config.diff.max_format_lines
@@ -688,8 +686,6 @@
"""
if self.context.preview_diff is not None:
return self.context.preview_diff
- if self.context.review_diff is not None:
- return self.context.review_diff.diff
return None
@property
=== modified file 'lib/lp/code/browser/tests/test_branchmergeproposal.py'
--- lib/lp/code/browser/tests/test_branchmergeproposal.py 2011-08-12 11:37:08 +0000
+++ lib/lp/code/browser/tests/test_branchmergeproposal.py 2011-08-26 00:48:47 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2010 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
# pylint: disable-msg=F0401
@@ -54,10 +54,7 @@
BranchMergeProposalStatus,
CodeReviewVote,
)
-from lp.code.model.diff import (
- PreviewDiff,
- StaticDiff,
- )
+from lp.code.model.diff import PreviewDiff
from lp.code.tests.helpers import (
add_revision_to_branch,
make_merge_proposal_without_reviewers,
@@ -725,14 +722,7 @@
self.assertEqual(diff_bytes.decode('windows-1252', 'replace'),
view.preview_diff_text)
- def addReviewDiff(self):
- review_diff_bytes = ''.join(unified_diff('', 'review'))
- review_diff = StaticDiff.acquireFromText('x', 'y', review_diff_bytes)
- self.bmp.review_diff = review_diff
- return review_diff
-
def addBothDiffs(self):
- self.addReviewDiff()
preview_diff_bytes = ''.join(unified_diff('', 'preview'))
return self.setPreviewDiff(preview_diff_bytes)
@@ -748,13 +738,6 @@
view = create_initialized_view(self.bmp, '+index')
self.assertEqual(preview_diff, view.preview_diff)
- def test_preview_diff_uses_review_diff(self):
- """The review diff will be used if there is no preview."""
- review_diff = self.addReviewDiff()
- view = create_initialized_view(self.bmp, '+index')
- self.assertEqual(review_diff.diff,
- view.preview_diff)
-
def test_review_diff_text_prefers_preview_diff(self):
"""The preview will be used for BMP with both a review and preview."""
preview_diff = self.addBothDiffs()
=== modified file 'lib/lp/code/configure.zcml'
--- lib/lp/code/configure.zcml 2011-06-20 18:58:27 +0000
+++ lib/lp/code/configure.zcml 2011-08-26 00:48:47 +0000
@@ -656,10 +656,6 @@
<class class="lp.code.model.branchjob.BranchJob">
<allow interface="lp.code.interfaces.branchjob.IBranchJob"/>
</class>
- <class class="lp.code.model.branchjob.BranchDiffJob">
- <allow interface="lp.code.interfaces.branchjob.IBranchDiffJob"/>
- <allow interface="lp.code.interfaces.branchjob.IBranchJob"/>
- </class>
<class class="lp.code.model.branchjob.RevisionMailJob">
<allow interface="lp.code.interfaces.branchjob.IRevisionMailJob"/>
<allow interface="lp.code.interfaces.branchjob.IBranchJob"/>
@@ -677,11 +673,6 @@
<allow interface="lp.code.interfaces.branchjob.IBranchJob"/>
</class>
<securedutility
- component="lp.code.model.branchjob.BranchDiffJob"
- provides="lp.code.interfaces.branchjob.IBranchDiffJobSource">
- <allow interface="lp.code.interfaces.branchjob.IBranchDiffJobSource"/>
- </securedutility>
- <securedutility
component="lp.code.model.branchjob.RevisionMailJob"
provides="lp.code.interfaces.branchjob.IRevisionMailJobSource">
<allow interface="lp.code.interfaces.branchjob.IRevisionMailJobSource"/>
@@ -889,20 +880,11 @@
<allow interface="lp.code.interfaces.diff.IDiff" />
<allow interface="lp.code.interfaces.diff.IIncrementalDiff" />
</class>
- <class class="lp.code.model.diff.StaticDiff">
- <allow interface="lp.code.interfaces.diff.IStaticDiff" />
- </class>
<class class="lp.code.model.diff.PreviewDiff">
<require
permission="launchpad.View"
interface="lp.code.interfaces.diff.IPreviewDiff"/>
</class>
- <securedutility
- component="lp.code.model.diff.StaticDiff"
- provides="lp.code.interfaces.diff.IStaticDiffSource" >
- <allow
- interface="lp.code.interfaces.diff.IStaticDiffSource" />
- </securedutility>
<!-- SourcePackageRecipe -->
=== modified file 'lib/lp/code/interfaces/branchjob.py'
--- lib/lp/code/interfaces/branchjob.py 2011-08-24 05:26:45 +0000
+++ lib/lp/code/interfaces/branchjob.py 2011-08-26 00:48:47 +0000
@@ -11,8 +11,6 @@
__all__ = [
'IBranchJob',
- 'IBranchDiffJob',
- 'IBranchDiffJobSource',
'IBranchScanJob',
'IBranchScanJobSource',
'IBranchUpgradeJob',
@@ -67,31 +65,6 @@
"""Destroy this object."""
-class IBranchDiffJob(Interface):
- """A job to create a static diff from a branch."""
-
- from_revision_spec = TextLine(title=_('The revision spec to diff from.'))
-
- to_revision_spec = TextLine(title=_('The revision spec to diff to.'))
-
- def run():
- """Acquire the static diff this job requires.
-
- :return: the generated StaticDiff.
- """
-
-
-class IBranchDiffJobSource(Interface):
-
- def create(branch, from_revision_spec, to_revision_spec):
- """Construct a new object that implements IBranchDiffJob.
-
- :param branch: The database branch to diff.
- :param from_revision_spec: The revision spec to diff from.
- :param to_revision_spec: The revision spec to diff to.
- """
-
-
class IBranchScanJob(IRunnableJob):
""" A job to scan branches."""
@@ -126,8 +99,6 @@
from_address = Bytes(title=u'The address to send mail from.')
- perform_diff = Text(title=u'Determine whether diff should be performed.')
-
body = Text(title=u'The main text of the email to send.')
subject = Text(title=u'The subject of the email to send.')
@@ -136,7 +107,7 @@
class IRevisionMailJobSource(Interface):
"""A utility to create and retrieve RevisionMailJobs."""
- def create(db_branch, revno, email_from, message, perform_diff, subject):
+ def create(db_branch, revno, email_from, message, subject):
"""Create and return a new object that implements IRevisionMailJob."""
def iterReady():
=== modified file 'lib/lp/code/interfaces/branchmergeproposal.py'
--- lib/lp/code/interfaces/branchmergeproposal.py 2011-03-23 16:28:51 +0000
+++ lib/lp/code/interfaces/branchmergeproposal.py 2011-08-26 00:48:47 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2010 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
# pylint: disable-msg=E0211,E0213
@@ -76,10 +76,7 @@
CodeReviewVote,
)
from lp.code.interfaces.branch import IBranch
-from lp.code.interfaces.diff import (
- IPreviewDiff,
- IStaticDiff,
- )
+from lp.code.interfaces.diff import IPreviewDiff
from lp.registry.interfaces.person import IPerson
from lp.services.fields import (
PublicPersonChoice,
@@ -174,10 +171,6 @@
description=_("The person that accepted (or rejected) the code "
"for merging.")))
- review_diff = Reference(
- IStaticDiff, title=_('The diff to be used for reviews.'),
- readonly=True)
-
next_preview_diff_job = Attribute(
'The next BranchMergeProposalJob that will update a preview diff.')
=== modified file 'lib/lp/code/interfaces/diff.py'
--- lib/lp/code/interfaces/diff.py 2011-07-13 13:03:35 +0000
+++ lib/lp/code/interfaces/diff.py 2011-08-26 00:48:47 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2010 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
# pylint: disable-msg=E0211,E0213
@@ -11,8 +11,6 @@
'IDiff',
'IIncrementalDiff',
'IPreviewDiff',
- 'IStaticDiff',
- 'IStaticDiffSource',
]
from lazr.restful.declarations import (
@@ -82,40 +80,6 @@
IRevision, readonly=True, title=_('The new revision of the diff.'))
-class IStaticDiff(Interface):
- """A diff with a fixed value, i.e. between two revisions."""
-
- from_revision_id = exported(TextLine(readonly=True))
-
- to_revision_id = exported(TextLine(readonly=True))
-
- diff = exported(
- Reference(IDiff, title=_('The Diff object.'), readonly=True))
-
- def destroySelf():
- """Destroy this object."""
-
-
-class IStaticDiffSource(Interface):
- """Component that can acquire StaticDiffs."""
-
- def acquire(from_revision_id, to_revision_id, repository, filename=None):
- """Get or create a StaticDiff."""
-
- def acquireFromText(from_revision_id, to_revision_id, text,
- filename=None):
- """Get or create a StaticDiff from a string.
-
- If a StaticDiff exists for this revision_id pair, the text is ignored.
-
- :param from_revision_id: The id of the old revision.
- :param to_revision_id: The id of the new revision.
- :param text: The text of the diff, as bytes.
- :param filename: The filename to store for the diff. Randomly
- generated if not supplied.
- """
-
-
class IPreviewDiff(IDiff):
"""A diff generated to show actual diff between two branches.
=== modified file 'lib/lp/code/interfaces/webservice.py'
--- lib/lp/code/interfaces/webservice.py 2011-06-16 18:51:45 +0000
+++ lib/lp/code/interfaces/webservice.py 2011-08-26 00:48:47 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2010 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""All the interfaces that are exposed through the webservice.
@@ -28,7 +28,6 @@
'IPreviewDiff',
'ISourcePackageRecipe',
'ISourcePackageRecipeBuild',
- 'IStaticDiff',
'TooManyBuilds',
]
@@ -57,7 +56,6 @@
from lp.code.interfaces.diff import (
IDiff,
IPreviewDiff,
- IStaticDiff,
)
from lp.code.interfaces.sourcepackagerecipe import ISourcePackageRecipe
from lp.code.interfaces.sourcepackagerecipebuild import (
=== modified file 'lib/lp/code/model/branch.py'
--- lib/lp/code/model/branch.py 2011-08-25 13:49:26 +0000
+++ lib/lp/code/model/branch.py 2011-08-26 00:48:47 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2010 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
# pylint: disable-msg=E0611,W0212,W0141,F0401
=== modified file 'lib/lp/code/model/branchjob.py'
--- lib/lp/code/model/branchjob.py 2011-08-22 17:40:02 +0000
+++ lib/lp/code/model/branchjob.py 2011-08-26 00:48:47 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2010 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
__all__ = [
@@ -30,10 +30,7 @@
show_log,
)
from bzrlib.revision import NULL_REVISION
-from bzrlib.revisionspec import (
- RevisionInfo,
- RevisionSpec,
- )
+from bzrlib.revisionspec import RevisionInfo
from bzrlib.transport import get_transport
from bzrlib.upgrade import upgrade
from lazr.delegates import delegates
@@ -79,8 +76,6 @@
BranchSubscriptionNotificationLevel,
)
from lp.code.interfaces.branchjob import (
- IBranchDiffJob,
- IBranchDiffJobSource,
IBranchJob,
IBranchScanJob,
IBranchScanJobSource,
@@ -97,7 +92,6 @@
from lp.code.mail.branch import BranchMailer
from lp.code.model.branch import Branch
from lp.code.model.branchmergeproposal import BranchMergeProposal
-from lp.code.model.diff import StaticDiff
from lp.code.model.revision import RevisionSet
from lp.codehosting.scanner.bzrsync import BzrSync
from lp.codehosting.vfs import (
@@ -285,50 +279,6 @@
return [format_address_for_person(self.requester)]
-class BranchDiffJob(BranchJobDerived):
- """A Job that calculates the a diff related to a Branch."""
-
- implements(IBranchDiffJob)
- classProvides(IBranchDiffJobSource)
-
- @classmethod
- def create(cls, branch, from_revision_spec, to_revision_spec):
- """See `IBranchDiffJobSource`."""
- metadata = cls.getMetadata(from_revision_spec, to_revision_spec)
- branch_job = BranchJob(branch, BranchJobType.STATIC_DIFF, metadata)
- return cls(branch_job)
-
- @staticmethod
- def getMetadata(from_revision_spec, to_revision_spec):
- return {
- 'from_revision_spec': from_revision_spec,
- 'to_revision_spec': to_revision_spec,
- }
-
- @property
- def from_revision_spec(self):
- return self.metadata['from_revision_spec']
-
- @property
- def to_revision_spec(self):
- return self.metadata['to_revision_spec']
-
- def _get_revision_id(self, bzr_branch, spec_string):
- spec = RevisionSpec.from_string(spec_string)
- return spec.as_revision_id(bzr_branch)
-
- def run(self):
- """See IBranchDiffJob."""
- bzr_branch = self.branch.getBzrBranch()
- from_revision_id = self._get_revision_id(
- bzr_branch, self.from_revision_spec)
- to_revision_id = self._get_revision_id(
- bzr_branch, self.to_revision_spec)
- static_diff = StaticDiff.acquire(
- from_revision_id, to_revision_id, bzr_branch.repository)
- return static_diff
-
-
class BranchScanJob(BranchJobDerived):
"""A Job that scans a branch for new revisions."""
@@ -447,8 +397,8 @@
shutil.rmtree(upgrade_branch_path)
-class RevisionMailJob(BranchDiffJob):
- """A Job that calculates the a diff related to a Branch."""
+class RevisionMailJob(BranchJobDerived):
+ """A Job that sends a mail for a scan of a Branch."""
implements(IRevisionMailJob)
@@ -457,43 +407,26 @@
class_job_type = BranchJobType.REVISION_MAIL
@classmethod
- def create(
- cls, branch, revno, from_address, body, perform_diff, subject):
+ def create(cls, branch, revno, from_address, body, subject):
"""See `IRevisionMailJobSource`."""
metadata = {
'revno': revno,
'from_address': from_address,
'body': body,
- 'perform_diff': perform_diff,
'subject': subject,
}
- if isinstance(revno, int) and revno > 0:
- from_revision_spec = str(revno - 1)
- to_revision_spec = str(revno)
- else:
- from_revision_spec = None
- to_revision_spec = None
- metadata.update(BranchDiffJob.getMetadata(from_revision_spec,
- to_revision_spec))
branch_job = BranchJob(branch, BranchJobType.REVISION_MAIL, metadata)
return cls(branch_job)
@property
def revno(self):
- revno = self.metadata['revno']
- if isinstance(revno, int):
- revno = long(revno)
- return revno
+ return self.metadata['revno']
@property
def from_address(self):
return str(self.metadata['from_address'])
@property
- def perform_diff(self):
- return self.metadata['perform_diff']
-
- @property
def body(self):
return self.metadata['body']
@@ -503,15 +436,9 @@
def getMailer(self):
"""Return a BranchMailer for this job."""
- if self.perform_diff and self.to_revision_spec is not None:
- diff = BranchDiffJob.run(self)
- transaction.commit()
- diff_text = diff.diff.text
- else:
- diff_text = None
return BranchMailer.forRevision(
self.branch, self.revno, self.from_address, self.body,
- diff_text, self.subject)
+ None, self.subject)
def run(self):
"""See `IRevisionMailJob`."""
=== modified file 'lib/lp/code/model/branchmergeproposal.py'
--- lib/lp/code/model/branchmergeproposal.py 2011-06-24 15:54:12 +0000
+++ lib/lp/code/model/branchmergeproposal.py 2011-08-26 00:48:47 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2010 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
# pylint: disable-msg=E0611,W0212,F0401
@@ -193,9 +193,6 @@
storm_validator=validate_public_person, notNull=False,
default=None)
- review_diff = ForeignKey(
- foreignKey='StaticDiff', notNull=False, default=None)
-
@property
def next_preview_diff_job(self):
# circular dependencies
=== modified file 'lib/lp/code/model/diff.py'
--- lib/lp/code/model/diff.py 2010-12-02 16:13:51 +0000
+++ lib/lp/code/model/diff.py 2011-08-26 00:48:47 +0000
@@ -1,10 +1,14 @@
-# Copyright 2009-2010 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Implementation classes for IDiff, etc."""
__metaclass__ = type
-__all__ = ['Diff', 'IncrementalDiff', 'PreviewDiff', 'StaticDiff']
+__all__ = [
+ 'Diff',
+ 'IncrementalDiff',
+ 'PreviewDiff',
+ ]
from contextlib import nested
from cStringIO import StringIO
@@ -34,10 +38,7 @@
)
from zope.component import getUtility
from zope.error.interfaces import IErrorReportingUtility
-from zope.interface import (
- classProvides,
- implements,
- )
+from zope.interface import implements
from canonical.config import config
from canonical.database.sqlbase import SQLBase
@@ -47,8 +48,6 @@
IDiff,
IIncrementalDiff,
IPreviewDiff,
- IStaticDiff,
- IStaticDiffSource,
)
from lp.codehosting.bzrutils import read_locked
@@ -290,53 +289,6 @@
return cls.fromFileAtEnd(diff_content)
-class StaticDiff(SQLBase):
- """A diff from one revision to another."""
-
- implements(IStaticDiff)
-
- classProvides(IStaticDiffSource)
-
- from_revision_id = StringCol()
-
- to_revision_id = StringCol()
-
- diff = ForeignKey(foreignKey='Diff', notNull=True)
-
- @classmethod
- def acquire(klass, from_revision_id, to_revision_id, repository,
- filename=None):
- """See `IStaticDiffSource`."""
- existing_diff = klass.selectOneBy(
- from_revision_id=from_revision_id, to_revision_id=to_revision_id)
- if existing_diff is not None:
- return existing_diff
- from_tree = repository.revision_tree(from_revision_id)
- to_tree = repository.revision_tree(to_revision_id)
- diff = Diff.fromTrees(from_tree, to_tree, filename)
- return klass(
- from_revision_id=from_revision_id, to_revision_id=to_revision_id,
- diff=diff)
-
- @classmethod
- def acquireFromText(klass, from_revision_id, to_revision_id, text,
- filename=None):
- """See `IStaticDiffSource`."""
- existing_diff = klass.selectOneBy(
- from_revision_id=from_revision_id, to_revision_id=to_revision_id)
- if existing_diff is not None:
- return existing_diff
- diff = Diff.fromFile(StringIO(text), len(text), filename)
- return klass(
- from_revision_id=from_revision_id, to_revision_id=to_revision_id,
- diff=diff)
-
- def destroySelf(self):
- diff = self.diff
- SQLBase.destroySelf(self)
- diff.destroySelf()
-
-
class IncrementalDiff(Storm):
"""See `IIncrementalDiff."""
@@ -451,7 +403,6 @@
# A preview diff is stale if the revision ids used to make the diff
# are different from the tips of the source or target branches.
bmp = self.branch_merge_proposal
- is_stale = False
if (self.source_revision_id != bmp.source_branch.last_scanned_id or
self.target_revision_id != bmp.target_branch.last_scanned_id):
# This is the simple frequent case.
=== modified file 'lib/lp/code/model/tests/test_branch.py'
--- lib/lp/code/model/tests/test_branch.py 2011-08-24 16:21:07 +0000
+++ lib/lp/code/model/tests/test_branch.py 2011-08-26 00:48:47 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2010 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
# pylint: disable-msg=F0401,E1002
@@ -98,7 +98,6 @@
update_trigger_modified_fields,
)
from lp.code.model.branchjob import (
- BranchDiffJob,
BranchJob,
BranchJobType,
ReclaimBranchSpaceJob,
@@ -1228,8 +1227,9 @@
def test_relatedBranchJobsDeleted(self):
# A branch with an associated branch job will delete those jobs.
- branch = self.factory.makeAnyBranch()
- BranchDiffJob.create(branch, 'from-spec', 'to-spec')
+ branch = self.factory.makeBranch(
+ branch_format=BranchFormat.BZR_BRANCH_6)
+ removeSecurityProxy(branch).requestUpgrade(branch.owner)
branch.destroySelf()
# Need to commit the transaction to fire off the constraint checks.
transaction.commit()
=== modified file 'lib/lp/code/model/tests/test_branchjob.py'
--- lib/lp/code/model/tests/test_branchjob.py 2011-08-22 18:43:18 +0000
+++ lib/lp/code/model/tests/test_branchjob.py 2011-08-26 00:48:47 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for BranchJobs."""
@@ -8,7 +8,6 @@
import datetime
import os
import shutil
-import tempfile
from bzrlib import errors as bzr_errors
from bzrlib.branch import (
@@ -54,7 +53,6 @@
)
from lp.code.errors import AlreadyLatestFormat
from lp.code.interfaces.branchjob import (
- IBranchDiffJob,
IBranchJob,
IBranchScanJob,
IBranchUpgradeJob,
@@ -64,7 +62,6 @@
IRosettaUploadJob,
)
from lp.code.model.branchjob import (
- BranchDiffJob,
BranchJob,
BranchJobDerived,
BranchJobType,
@@ -126,113 +123,6 @@
self.assertIs(None, derived.getOopsMailController('x'))
-class TestBranchDiffJob(TestCaseWithFactory):
- """Tests for BranchDiffJob."""
-
- layer = LaunchpadZopelessLayer
-
- def test_providesInterface(self):
- """Ensure that BranchDiffJob implements IBranchDiffJob."""
- verifyObject(
- IBranchDiffJob, BranchDiffJob.create(1, '0', '1'))
-
- def test_run_revision_ids(self):
- """Ensure that run calculates revision ids."""
- self.useBzrBranches(direct_database=True)
- branch, tree = self.create_branch_and_tree()
- # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
- # required to generate the revision-id.
- with override_environ(BZR_EMAIL='me@xxxxxxxxxxx'):
- tree.commit('First commit', rev_id='rev1')
- job = BranchDiffJob.create(branch, '0', '1')
- static_diff = job.run()
- self.assertEqual('null:', static_diff.from_revision_id)
- self.assertEqual('rev1', static_diff.to_revision_id)
-
- def test_run_diff_content(self):
- """Ensure that run generates expected diff."""
- self.useBzrBranches(direct_database=True)
-
- tree_location = tempfile.mkdtemp()
- self.addCleanup(lambda: shutil.rmtree(tree_location))
-
- branch, tree = self.create_branch_and_tree(
- tree_location=tree_location)
- tree_file = os.path.join(tree_location, 'file')
- open(tree_file, 'wb').write('foo\n')
- tree.add('file')
- # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
- # required to generate the revision-id.
- with override_environ(BZR_EMAIL='me@xxxxxxxxxxx'):
- tree.commit('First commit')
- open(tree_file, 'wb').write('bar\n')
- tree.commit('Next commit')
- job = BranchDiffJob.create(branch, '1', '2')
- static_diff = job.run()
- transaction.commit()
- content_lines = static_diff.diff.text.splitlines()
- self.assertEqual(
- content_lines[3:], ['@@ -1,1 +1,1 @@', '-foo', '+bar', ''],
- content_lines[3:])
- self.assertEqual(7, len(content_lines))
-
- def test_run_is_idempotent(self):
- """Ensure running an equivalent job emits the same diff."""
- self.useBzrBranches(direct_database=True)
- branch, tree = self.create_branch_and_tree()
- # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
- # required to generate the revision-id.
- with override_environ(BZR_EMAIL='me@xxxxxxxxxxx'):
- tree.commit('First commit')
- job1 = BranchDiffJob.create(branch, '0', '1')
- static_diff1 = job1.run()
- job2 = BranchDiffJob.create(branch, '0', '1')
- static_diff2 = job2.run()
- self.assertTrue(static_diff1 is static_diff2)
-
- def create_rev1_diff(self):
- """Create a StaticDiff for use by test methods.
-
- This diff contains an add of a file called hello.txt, with contents
- "Hello World\n".
- """
- self.useBzrBranches(direct_database=True)
- branch, tree = self.create_branch_and_tree()
- tree_transport = tree.bzrdir.root_transport
- tree_transport.put_bytes("hello.txt", "Hello World\n")
- tree.add('hello.txt')
- # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
- # required to generate the revision-id.
- with override_environ(BZR_EMAIL='me@xxxxxxxxxxx'):
- tree.commit('rev1', timestamp=1e9, timezone=0)
- job = BranchDiffJob.create(branch, '0', '1')
- diff = job.run()
- transaction.commit()
- return diff
-
- def test_diff_contents(self):
- """Ensure the diff contents match expectations."""
- diff = self.create_rev1_diff()
- expected = (
- "=== added file 'hello.txt'" '\n'
- "--- hello.txt" '\t' "1970-01-01 00:00:00 +0000" '\n'
- "+++ hello.txt" '\t' "2001-09-09 01:46:40 +0000" '\n'
- "@@ -0,0 +1,1 @@" '\n'
- "+Hello World" '\n'
- '\n')
- self.assertEqual(diff.diff.text, expected)
-
- def test_diff_is_bytes(self):
- """Diffs should be bytestrings.
-
- Diffs have no single encoding, because they may encompass files in
- multiple encodings. Therefore, we consider them binary, to avoid
- lossy decoding.
- """
- diff = self.create_rev1_diff()
- self.assertIsInstance(diff.diff.text, str)
-
-
class TestBranchScanJob(TestCaseWithFactory):
"""Tests for `BranchScanJob`."""
@@ -390,7 +280,7 @@
class TestRevisionMailJob(TestCaseWithFactory):
- """Tests for BranchDiffJob."""
+ """Tests for RevisionMailJob."""
layer = LaunchpadZopelessLayer
@@ -398,14 +288,14 @@
"""Ensure that RevisionMailJob implements IRevisionMailJob."""
branch = self.factory.makeAnyBranch()
job = RevisionMailJob.create(
- branch, 0, 'from@xxxxxxxxxxx', 'hello', False, 'subject')
+ branch, 0, 'from@xxxxxxxxxxx', 'hello', 'subject')
verifyObject(IRevisionMailJob, job)
def test_repr(self):
"""Ensure that the revision mail job as a reasonable repr."""
branch = self.factory.makeAnyBranch()
job = RevisionMailJob.create(
- branch, 0, 'from@xxxxxxxxxxx', 'hello', False, 'subject')
+ branch, 0, 'from@xxxxxxxxxxx', 'hello', 'subject')
self.assertEqual(
'<REVISION_MAIL branch job (%s) for %s>'
% (job.context.id, branch.unique_name),
@@ -421,7 +311,7 @@
CodeReviewNotificationLevel.FULL,
branch.registrant)
job = RevisionMailJob.create(
- branch, 0, 'from@xxxxxxxxxxx', 'hello', False, 'subject')
+ branch, 0, 'from@xxxxxxxxxxx', 'hello', 'subject')
job.run()
(mail, ) = pop_notifications()
self.assertEqual('0', mail['X-Launchpad-Branch-Revision-Number'])
@@ -444,53 +334,14 @@
"""Ensure that revnos can be strings."""
branch = self.factory.makeAnyBranch()
job = RevisionMailJob.create(
- branch, 'removed', 'from@xxxxxxxxxxx', 'hello', False, 'subject')
+ branch, 'removed', 'from@xxxxxxxxxxx', 'hello', 'subject')
self.assertEqual('removed', job.revno)
- def test_revno_long(self):
- "Ensure that the revno is a long, not an int."
- branch = self.factory.makeAnyBranch()
- job = RevisionMailJob.create(
- branch, 1, 'from@xxxxxxxxxxx', 'hello', False, 'subject')
- self.assertIsInstance(job.revno, long)
-
- def test_perform_diff_performs_diff(self):
- """Ensure that a diff is generated when perform_diff is True."""
- self.useBzrBranches(direct_database=True)
- branch, tree = self.create_branch_and_tree()
- tree.bzrdir.root_transport.put_bytes('foo', 'bar\n')
- tree.add('foo')
- # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
- # required to generate the revision-id.
- with override_environ(BZR_EMAIL='me@xxxxxxxxxxx'):
- tree.commit('First commit')
- job = RevisionMailJob.create(
- branch, 1, 'from@xxxxxxxxxxx', 'hello', True, 'subject')
- mailer = job.getMailer()
- self.assertIn('+bar\n', mailer.diff)
-
- def test_perform_diff_ignored_for_revno_0(self):
- """For the null revision, no diff is generated."""
- self.useBzrBranches(direct_database=True)
- branch, tree = self.create_branch_and_tree()
- job = RevisionMailJob.create(
- branch, 0, 'from@xxxxxxxxxxx', 'hello', True, 'subject')
- self.assertIs(None, job.from_revision_spec)
- self.assertIs(None, job.to_revision_spec)
- mailer = job.getMailer()
- self.assertIs(None, mailer.diff)
-
- def test_iterReady_ignores_BranchDiffJobs(self):
- """Only BranchDiffJobs should not be listed."""
- branch = self.factory.makeAnyBranch()
- BranchDiffJob.create(branch, 0, 1)
- self.assertEqual([], list(RevisionMailJob.iterReady()))
-
def test_iterReady_includes_ready_jobs(self):
"""Ready jobs should be listed."""
branch = self.factory.makeAnyBranch()
job = RevisionMailJob.create(
- branch, 0, 'from@xxxxxxxxxxx', 'body', False, 'subject')
+ branch, 0, 'from@xxxxxxxxxxx', 'body', 'subject')
job.job.sync()
job.context.sync()
self.assertEqual([job], list(RevisionMailJob.iterReady()))
@@ -499,7 +350,7 @@
"""Unready jobs should not be listed."""
branch = self.factory.makeAnyBranch()
job = RevisionMailJob.create(
- branch, 0, 'from@xxxxxxxxxxx', 'body', False, 'subject')
+ branch, 0, 'from@xxxxxxxxxxx', 'body', 'subject')
job.job.start()
job.job.complete()
self.assertEqual([], list(RevisionMailJob.iterReady()))
@@ -1306,7 +1157,9 @@
self._makeProductSeries(
TranslationsBranchImportMode.IMPORT_TEMPLATES)
# Add a job that is not a RosettaUploadJob.
- BranchDiffJob.create(self.branch, 0, 1)
+ branch = self.factory.makeBranch(
+ branch_format=BranchFormat.BZR_BRANCH_6)
+ BranchUpgradeJob.create(branch, branch.owner)
ready_jobs = list(RosettaUploadJob.iterReady())
self.assertEqual([], ready_jobs)
=== modified file 'lib/lp/code/model/tests/test_diff.py'
--- lib/lp/code/model/tests/test_diff.py 2011-08-13 04:07:10 +0000
+++ lib/lp/code/model/tests/test_diff.py 2011-08-26 00:48:47 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2010 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for Diff, etc."""
@@ -29,16 +29,12 @@
IDiff,
IIncrementalDiff,
IPreviewDiff,
- IStaticDiff,
- IStaticDiffSource,
)
from lp.code.model.diff import (
Diff,
PreviewDiff,
- StaticDiff,
)
from lp.code.model.directbranchcommit import DirectBranchCommit
-from lp.services.osutils import override_environ
from lp.testing import (
login,
login_person,
@@ -292,84 +288,6 @@
self.assertIs(None, diff.removed_lines_count)
-class TestStaticDiff(TestCaseWithFactory):
- """Test that StaticDiff objects work."""
-
- layer = LaunchpadZopelessLayer
-
- def test_providesInterface(self):
- verifyObject(IStaticDiff, StaticDiff())
-
- def test_providesSourceInterface(self):
- verifyObject(IStaticDiffSource, StaticDiff)
-
- def test_acquire_existing(self):
- """Ensure that acquire returns the existing StaticDiff."""
- self.useBzrBranches(direct_database=True)
- branch, tree = self.create_branch_and_tree()
- # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
- # required to generate the revision-id.
- with override_environ(BZR_EMAIL='me@xxxxxxxxxxx'):
- tree.commit('First commit', rev_id='rev1')
- diff1 = StaticDiff.acquire('null:', 'rev1', tree.branch.repository)
- diff2 = StaticDiff.acquire('null:', 'rev1', tree.branch.repository)
- self.assertIs(diff1, diff2)
-
- def test_acquire_existing_different_repo(self):
- """The existing object is used even if the repository is different."""
- self.useBzrBranches(direct_database=True)
- branch1, tree1 = self.create_branch_and_tree('tree1')
- # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
- # required to generate the revision-id.
- with override_environ(BZR_EMAIL='me@xxxxxxxxxxx'):
- tree1.commit('First commit', rev_id='rev1')
- branch2, tree2 = self.create_branch_and_tree('tree2')
- tree2.pull(tree1.branch)
- diff1 = StaticDiff.acquire('null:', 'rev1', tree1.branch.repository)
- diff2 = StaticDiff.acquire('null:', 'rev1', tree2.branch.repository)
- self.assertTrue(diff1 is diff2)
-
- def test_acquire_nonexisting(self):
- """A new object is created if there is no existant matching object."""
- self.useBzrBranches(direct_database=True)
- branch, tree = self.create_branch_and_tree()
- # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
- # required to generate the revision-id.
- with override_environ(BZR_EMAIL='me@xxxxxxxxxxx'):
- tree.commit('First commit', rev_id='rev1')
- tree.commit('Next commit', rev_id='rev2')
- diff1 = StaticDiff.acquire('null:', 'rev1', tree.branch.repository)
- diff2 = StaticDiff.acquire('rev1', 'rev2', tree.branch.repository)
- self.assertIsNot(diff1, diff2)
-
- def test_acquireFromText(self):
- """acquireFromText works as expected.
-
- It creates a new object if there is none, but uses the existing one
- if possible.
- """
- diff_a = ''.join(unified_diff('', 'a'))
- diff_b = ''.join(unified_diff('', 'b'))
- static_diff = StaticDiff.acquireFromText(
- 'rev1', 'rev2', diff_a)
- self.assertEqual('rev1', static_diff.from_revision_id)
- self.assertEqual('rev2', static_diff.to_revision_id)
- static_diff2 = StaticDiff.acquireFromText(
- 'rev1', 'rev2', diff_b)
- self.assertIs(static_diff, static_diff2)
-
- def test_acquireFromTextEmpty(self):
- static_diff = StaticDiff.acquireFromText('rev1', 'rev2', '')
- self.assertEqual('', static_diff.diff.text)
-
- def test_acquireFromTextNonEmpty(self):
- diff_bytes = ''.join(unified_diff('', 'abc'))
- static_diff = StaticDiff.acquireFromText(
- 'rev1', 'rev2', diff_bytes)
- transaction.commit()
- self.assertEqual(diff_bytes, static_diff.diff.text)
-
-
class TestPreviewDiff(DiffTestCase):
"""Test that PreviewDiff objects work."""
@@ -467,8 +385,8 @@
bzr_target = self.createBzrBranch(bmp.target_branch)
commit_file(bmp.target_branch, 'foo', 'a\n')
self.createBzrBranch(bmp.source_branch, bzr_target)
- source_rev_id = commit_file(bmp.source_branch, 'foo', 'a\nb\n')
- target_rev_id = commit_file(bmp.target_branch, 'foo', 'c\na\n')
+ commit_file(bmp.source_branch, 'foo', 'a\nb\n')
+ commit_file(bmp.target_branch, 'foo', 'c\na\n')
diff = PreviewDiff.fromBranchMergeProposal(bmp)
self.assertEqual('', diff.conflicts)
self.assertFalse(diff.has_conflicts)
@@ -509,7 +427,7 @@
logger = logging.getLogger('bzr')
logger.addHandler(handler)
try:
- preview = PreviewDiff.fromBranchMergeProposal(bmp)
+ PreviewDiff.fromBranchMergeProposal(bmp)
self.assertEqual(handler.records, [])
# check that our handler would normally intercept warnings.
trace.warning('foo!')
=== modified file 'lib/lp/code/scripts/tests/test_sendbranchmail.py'
--- lib/lp/code/scripts/tests/test_sendbranchmail.py 2011-08-13 04:07:10 +0000
+++ lib/lp/code/scripts/tests/test_sendbranchmail.py 2011-08-26 00:48:47 +0000
@@ -1,6 +1,4 @@
-#! /usr/bin/python
-#
-# Copyright 2009 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Test the sendbranchmail script"""
@@ -48,7 +46,7 @@
self.useBzrBranches()
branch, tree = self.createBranch()
mail_job = RevisionMailJob.create(
- branch, 1, 'from@xxxxxxxxxxx', 'body', True, 'foo')
+ branch, 1, 'from@xxxxxxxxxxx', 'body', 'foo')
transaction.commit()
retcode, stdout, stderr = run_script(
'cronscripts/sendbranchmail.py', [])
@@ -63,8 +61,8 @@
"""Ensure sendbranchmail runs and sends email."""
self.useTempBzrHome()
branch = self.factory.makeBranch()
- RevisionMailJob.create(
- branch, 1, 'from@xxxxxxxxxxx', 'body', True, 'foo')
+ RevisionsAddedJob.create(
+ branch, 'rev1', 'rev2', 'from@xxxxxxxxxxx')
transaction.commit()
retcode, stdout, stderr = run_script(
'cronscripts/sendbranchmail.py', [])
=== modified file 'lib/lp/codehosting/scanner/email.py'
--- lib/lp/codehosting/scanner/email.py 2010-08-20 20:31:18 +0000
+++ lib/lp/codehosting/scanner/email.py 2011-08-26 00:48:47 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Email code for the branch scanner."""
@@ -49,7 +49,7 @@
getUtility(IRevisionMailJobSource).create(
revisions_removed.db_branch, revno='removed',
from_address=config.canonical.noreply_from_address,
- body=contents, perform_diff=False, subject=subject)
+ body=contents, subject=subject)
def queue_tip_changed_email_jobs(tip_changed):
@@ -68,7 +68,7 @@
tip_changed.db_branch.unique_name, revisions)
getUtility(IRevisionMailJobSource).create(
tip_changed.db_branch, 'initial',
- config.canonical.noreply_from_address, message, False, subject)
+ config.canonical.noreply_from_address, message, subject)
else:
getUtility(IRevisionsAddedJobSource).create(
tip_changed.db_branch, tip_changed.db_branch.last_scanned_id,
=== removed file 'lib/lp/codehosting/tests/test_jobs.py'
--- lib/lp/codehosting/tests/test_jobs.py 2011-08-12 11:37:08 +0000
+++ lib/lp/codehosting/tests/test_jobs.py 1970-01-01 00:00:00 +0000
@@ -1,48 +0,0 @@
-# Copyright 2009 Canonical Ltd. This software is licensed under the
-# GNU Affero General Public License version 3 (see the file LICENSE).
-
-"""Tests for Job-running facilities."""
-
-from canonical.config import config
-from canonical.testing.layers import LaunchpadZopelessLayer
-from lp.code.enums import (
- BranchSubscriptionDiffSize,
- BranchSubscriptionNotificationLevel,
- CodeReviewNotificationLevel,
- )
-from lp.code.model.branchjob import RevisionMailJob
-from lp.code.model.diff import StaticDiff
-from lp.services.job.runner import JobRunner
-from lp.services.osutils import override_environ
-from lp.testing import TestCaseWithFactory
-
-
-class TestRevisionMailJob(TestCaseWithFactory):
- """Ensure RevisionMailJob behaves as expected."""
-
- layer = LaunchpadZopelessLayer
-
- def test_runJob_generates_diff(self):
- """Ensure that a diff is actually generated in this environment."""
- self.useBzrBranches(direct_database=True)
- branch, tree = self.create_branch_and_tree()
- branch.subscribe(branch.registrant,
- BranchSubscriptionNotificationLevel.FULL,
- BranchSubscriptionDiffSize.WHOLEDIFF,
- CodeReviewNotificationLevel.FULL, branch.registrant)
- tree_transport = tree.bzrdir.root_transport
- tree_transport.put_bytes("hello.txt", "Hello World\n")
- tree.add('hello.txt')
- # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
- # required to generate the revision-id.
- with override_environ(BZR_EMAIL='me@xxxxxxxxxxx'):
- to_revision_id = tree.commit('rev1', timestamp=1e9, timezone=0)
- job = RevisionMailJob.create(
- branch, 1, 'from@xxxxxxxxxxx', 'body', True, 'subject')
- LaunchpadZopelessLayer.txn.commit()
- LaunchpadZopelessLayer.switchDbUser(config.sendbranchmail.dbuser)
- runner = JobRunner(job)
- runner.runJob(job)
- existing_diff = StaticDiff.selectOneBy(
- from_revision_id='null:', to_revision_id=to_revision_id)
- self.assertIsNot(None, existing_diff)
=== modified file 'lib/lp/testing/factory.py'
--- lib/lp/testing/factory.py 2011-08-16 09:14:07 +0000
+++ lib/lp/testing/factory.py 2011-08-26 00:48:47 +0000
@@ -158,7 +158,6 @@
from lp.code.model.diff import (
Diff,
PreviewDiff,
- StaticDiff,
)
from lp.code.model.recipebuild import RecipeBuildRecord
from lp.codehosting.codeimport.worker import CodeImportSourceDetails
@@ -1550,11 +1549,6 @@
return merge_proposal.generateIncrementalDiff(
old_revision, new_revision, diff)
- def makeStaticDiff(self):
- return StaticDiff.acquireFromText(
- self.getUniqueUnicode(), self.getUniqueUnicode(),
- self.getUniqueString())
-
def makeRevision(self, author=None, revision_date=None, parent_ids=None,
rev_id=None, log_body=None, date_created=None):
"""Create a single `Revision`."""