Merge lp:~mwhudson/launchpad-cscvs/more-revision-properties into lp:launchpad-cscvs

Proposed by Michael Hudson-Doyle
Status: Merged
Approved by: Paul Hummer
Approved revision: 432
Merged at revision: not available
Proposed branch: lp:~mwhudson/launchpad-cscvs/more-revision-properties
Merge into: lp:launchpad-cscvs
Diff against target: None lines
To merge this branch: bzr merge lp:~mwhudson/launchpad-cscvs/more-revision-properties
Reviewer Review Type Date Requested Status
Paul Hummer (community) Approve
Jelmer Vernooij (community) Approve
Review via email: mp+7495@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Hi Paul,

Hope you don't mind me slinging this cscvs branch at you. It addresses bug #164065 where Jelmer asks for us to record more information about where an import comes from. I'm also going to ask Jelmer to look at this merge proposal...

Cheers,
mwh

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Hi Michael,

The code changes look good, and the information provided would be sufficient for the in-progress "bzr rebase --by-path" to use. I'm not familiar with the Launchpad coding style, so I'll leave it up to rockstar to comment on that.

review: Approve
Revision history for this message
Paul Hummer (rockstar) wrote :

So, I feel the technical merits of this branch have really been addressed by Jelmer's comments, and that I have nothing to add. I do, however, wonder how this is going to affect existing branches. It looks like it's not, until we make the change, but it also looks like it's going to require a rebasing of these existing import branches to get these extra rev props. Is this true? Are we okay with this. If we're okay with breaking old branches, why aren't we just going directly to bzr-svn.

I'm approving this branch, but also making a note that I'd like to chat with you about this when you're around.

review: Approve
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Paul Hummer wrote:
> Review: Approve So, I feel the technical merits of this branch have
> really been addressed by Jelmer's comments, and that I have nothing
> to add. I do, however, wonder how this is going to affect existing
> branches. It looks like it's not, until we make the change, but it
> also looks like it's going to require a rebasing of these existing
> import branches to get these extra rev props. Is this true? Are
> we okay with this. If we're okay with breaking old branches, why
> aren't we just going directly to bzr-svn.
>
> I'm approving this branch, but also making a note that I'd like to
> chat with you about this when you're around
We plan to add magic in bzr-rebase that allows it to recognize
revisions that were imported by bzr-svn and cscvs independently are
both created from the same original svn revision. These new properties
should make it easier in the future for people to rebase their
existing branches that are were derived from cscvs imports onto a
bzr-svn branch by running a simple command ("bzr svn-upgrade") rather
than having to replay every single commit manually.

Re-annotating old revisions with this information would make rebase's
job a bit easier, but shouldn't strictly be necessary and it would
indeed kind of defeat the purpose of doing all of this in the first
place :-)

Cheers,

Jelmer
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iJwEAQECAAYFAko32dYACgkQDLQl4QYPZuVjGQP+PwMrSHyPRGm5Omk5dPvqumuO
C4q7MCskIeizYCBDlBqwwfEjt4+hi9t9mmDxADx0P4sGrapLvmQK1c4a5FDlMG2d
kr2cFBbAYBynldNEdBN5e/kDn/x+c4XGCFje6Cr0ruV1KiXO43V30Eeg+b24tqA+
5BX6pODB78obdjz5NiY=
=q8yG
-----END PGP SIGNATURE-----

433. By Michael Hudson-Doyle

fix a test

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'modules/CVS/changeset.py'
2--- modules/CVS/changeset.py 2008-09-15 19:03:13 +0000
3+++ modules/CVS/changeset.py 2009-06-16 03:28:06 +0000
4@@ -173,6 +173,10 @@
5 """the 'name' of this changeset"""
6 return ".".join([self.branchName, str(self.index)])
7
8+ def get_extra_revprops(self):
9+ """See `IRevision`."""
10+ return {}
11+
12 def get_log(self):
13 return self.log
14
15
16=== modified file 'modules/SCM/__init__.py'
17--- modules/SCM/__init__.py 2007-05-07 18:00:34 +0000
18+++ modules/SCM/__init__.py 2009-06-16 08:39:52 +0000
19@@ -124,7 +124,10 @@
20 """my date in seconds since the epoch"""
21
22 def get_fullname():
23- """the fully qualified identifier to refere to this revision"""
24+ """the fully qualified identifier to refer to this revision"""
25+
26+ def get_extra_revprops():
27+ """any extra data to store as revision properties"""
28
29 def get_log():
30 """my unparsed, raw log"""
31
32=== modified file 'modules/cscvs/bzr.py'
33--- modules/cscvs/bzr.py 2008-09-16 16:47:31 +0000
34+++ modules/cscvs/bzr.py 2009-06-16 03:28:06 +0000
35@@ -163,6 +163,7 @@
36 revprops = {
37 'cscvs-id': revision.get_fullname(),
38 'converted-by': 'launchpad.net'}
39+ revprops.update(revision.get_extra_revprops())
40 cvs_default_filler = revision.getCvsDefaultFiller()
41 if cvs_default_filler is not None:
42 revprops['cscvs-defaultfiller'] = cvs_default_filler
43
44=== modified file 'modules/cscvs/tests/test_bzr.py'
45--- modules/cscvs/tests/test_bzr.py 2008-09-16 16:47:31 +0000
46+++ modules/cscvs/tests/test_bzr.py 2009-06-16 06:04:43 +0000
47@@ -192,6 +192,15 @@
48 sorted([self.dir_relpath, self.file_relpath]))
49
50
51+class TestChangeset(CVS.TemporaryChangeset):
52+ """A changeset that allows specification of extra revision properties."""
53+
54+ _extra_revprops = {}
55+
56+ def get_extra_revprops(self):
57+ return self._extra_revprops
58+
59+
60 class BzrCommitTestCase(BzrWorkingTreeTestCase):
61
62 def setUp(self):
63@@ -205,10 +214,9 @@
64 self.message = 'message'
65 self.default_filler = '1.1.1.1 1.1 file_name'
66
67- def makeChangeset(self, is_filler):
68+ def makeChangeset(self, is_filler, extra_revprops):
69 """Create test changeset, either normal or filler."""
70- changeset = CVS.TemporaryChangeset(
71- self.branch, self.creator, self.logger)
72+ changeset = TestChangeset(self.branch, self.creator, self.logger)
73 changeset.log = self.message
74 changeset.index = self.branch_index
75 factory = TestUtil.RevisionFactory()
76@@ -221,18 +229,20 @@
77 if is_filler:
78 revision.fromRevision = '1.1'
79 changeset.append(revision)
80+ if extra_revprops is not None:
81+ changeset._extra_revprops = extra_revprops
82 return changeset
83
84- def commit(self, strict, is_filler):
85+ def commit(self, strict, is_filler, extra_revprops=None):
86 """Commit with a test changeset, either normal or filler."""
87- changeset = self.makeChangeset(is_filler)
88+ changeset = self.makeChangeset(is_filler, extra_revprops)
89 self.tree.commitWithAutomaticLog(
90 changeset, logger=self.logger, strict=strict, summarize=False)
91
92
93 class TestBzrWorkingTreeCommit(BzrCommitTestCase):
94
95- def assertRevisionEqualsExpected(self, is_filler):
96+ def assertRevisionEqualsExpected(self, is_filler, extra_revprops=None):
97 """Check that the last revision matches expectations."""
98 revision = self.getLastRevision()
99 self.assertEqual(revision.committer, self.creator)
100@@ -245,6 +255,8 @@
101 'converted-by': 'launchpad.net'}
102 if is_filler:
103 expected_properties['cscvs-defaultfiller'] = self.default_filler
104+ if extra_revprops is not None:
105+ expected_properties.update(extra_revprops)
106 self.assertEqual(revision.properties, expected_properties)
107
108 def getLastRevision(self):
109@@ -312,6 +324,13 @@
110 self.commit(strict=False, is_filler=False)
111 self.assertNotEqual(self.getLastRevision(), None)
112
113+ def testCommitWithExtraProperties(self):
114+ # commitWithAutomaticLog stores any extra revision properties defined
115+ # by the revision.
116+ self.commit(strict=True, is_filler=False, extra_revprops={'foo': 'bar'})
117+ self.assertRevisionEqualsExpected(
118+ is_filler=False, extra_revprops={'foo': 'bar'})
119+
120
121 class TestBzrBranch(BzrCommitTestCase):
122
123
124=== modified file 'modules/svn_oo/Revision.py'
125--- modules/svn_oo/Revision.py 2009-04-30 07:00:14 +0000
126+++ modules/svn_oo/Revision.py 2009-06-16 08:37:12 +0000
127@@ -14,6 +14,7 @@
128 from svn.core import (svn_opt_revision_t,
129 svn_opt_revision_head,
130 svn_opt_revision_number)
131+from svn.wc import (svn_wc_adm_open, svn_wc_entry)
132 import pysvn
133
134 import SCM
135@@ -96,6 +97,14 @@
136 """The current revision identifier."""
137 return str(self.rev.number)
138
139+ def get_extra_revprops(self):
140+ """See `IRevision`."""
141+ adm = svn_wc_adm_open(None, self.path, False, 0)
142+ uuid = svn_wc_entry(self.path, adm, True).uuid
143+ return {'cscvs-svn-branch-path': self.repoPrefix(),
144+ 'cscvs-svn-repository-uuid': uuid,
145+ 'cscvs-svn-revision-number': str(self.rev.number)}
146+
147 def get_log(self):
148 """My raw log, as an utf8 encoded str."""
149 return self.log['message'].encode('utf8')
150
151=== modified file 'modules/svn_oo/tests/test_revision.py'
152--- modules/svn_oo/tests/test_revision.py 2009-01-25 16:23:16 +0000
153+++ modules/svn_oo/tests/test_revision.py 2009-06-16 08:24:20 +0000
154@@ -12,6 +12,7 @@
155 import unittest
156
157 import pysvn
158+import svn.repos, svn.fs
159 from zope.interface.verify import verifyClass
160
161 import SCM
162@@ -128,6 +129,17 @@
163 # svn_oo.Revision.get_fullname return something useful
164 self.assertEqual(self.rev1().get_fullname(), "1")
165
166+ def testExtraRevprops(self):
167+ # svn_oo.Revision.get_extra_revprops returns information about where
168+ # the revision came from.
169+ repo = svn.repos.open(repo_cache.oneFileRepo().repo.path)
170+ uuid = svn.fs.get_uuid(svn.repos.fs(repo))
171+ self.assertEqual(
172+ {'cscvs-svn-branch-path': 'modulefile1',
173+ 'cscvs-svn-repository-uuid': uuid,
174+ 'cscvs-svn-revision-number': '1'},
175+ self.rev1().get_extra_revprops())
176+
177 def testGetDate(self):
178 # svn_oo.Revision.get_timestamp does something useful
179 csetdir=",,csetget_fullname"

Subscribers

People subscribed via source and target branches