Merge lp:~brook/bzr-cvsps-import/fix-402690-788914-788915 into lp:bzr-cvsps-import

Proposed by Brook Stevens
Status: Merged
Approved by: John A Meinel
Approved revision: 69
Merged at revision: 69
Proposed branch: lp:~brook/bzr-cvsps-import/fix-402690-788914-788915
Merge into: lp:bzr-cvsps-import
Diff against target: 62 lines (+16/-4)
1 file modified
cvsps/importer.py (+16/-4)
To merge this branch: bzr merge lp:~brook/bzr-cvsps-import/fix-402690-788914-788915
Reviewer Review Type Date Requested Status
Bazaar Developers Pending
Review via email: mp+62587@code.launchpad.net

Description of the change

Fixes 402690, 788914 and 788915. Also when a commit message fails it will log a warning message rather than failing. For converting a large repository where it may take over a day to run this was desirable to me and maybe others will find it useful.
Tested using the following configuration:
Bazaar (bzr) 2.3.1
  Python interpreter: /usr/bin/python 2.7.1
  Python standard library: /usr/lib/python2.7
  Platform: Linux-2.6.38-8-virtual-x86_64-with-Ubuntu-11.04-natty
  bzrlib: /usr/lib/python2.7/dist-packages/bzrlib
  Bazaar configuration: /home/ubuntu/.bazaar
  Bazaar log file: /home/ubuntu/.bzr.log

To post a comment you must log in.
Revision history for this message
John A Meinel (jameinel) wrote :

I'm fine landing this, though generally you should look more at "bzr-fastimport" and the cvs2bzr toolchain. (part of the cvs2svn family, IIRC).

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'cvsps/importer.py'
2--- cvsps/importer.py 2011-03-24 17:48:28 +0000
3+++ cvsps/importer.py 2011-05-27 02:03:26 +0000
4@@ -467,7 +467,16 @@
5
6 builder.finish_inventory()
7 message = self._escape_commit_message(message)
8- new_revision_id = builder.commit(message)
9+ try:
10+ new_revision_id = builder.commit(message)
11+ except ValueError:
12+ lost_message = 'Lost CVS commit message during bzr conversion'
13+ new_revision_id = builder.commit(lost_message)
14+ trace.warning('WARNING The following cvs commit message was lost during the bzr import:')
15+ trace.warning('==============================')
16+ trace.warning(message)
17+ trace.warning('==============================')
18+ trace.warning('Using "{0}" instead and continuing'.format(lost_message))
19 except:
20 builder.abort()
21 raise
22@@ -484,6 +493,7 @@
23 message, escape_count = self._message_escape_re.subn(
24 lambda match: match.group(0).encode('unicode_escape'),
25 message)
26+ message=message.replace('\r\n','\n').replace('\r','\n')
27 return message
28
29
30@@ -1183,11 +1193,13 @@
31 """Open the bzr repository, creating it if needed."""
32 self.setup_directories()
33 bzr_repo_transport = transport.get_transport(self._repo_path)
34+ is_branch = True
35 try:
36 a_bzrdir = bzrdir.BzrDir.open_from_transport(bzr_repo_transport)
37 except errors.NotBranchError:
38+ is_branch = False
39 return self._create_bzr_repo(bzr_repo_transport)
40- if self._tag_style == 'tag' and (
41+ if self._tag_style == 'tag' and not is_branch and (
42 not a_bzrdir.find_branch_format().supports_tags()):
43 newFormat = bzrdir.format_registry.get_default()
44 converter = a_bzrdir._format.get_converter(newFormat)
45@@ -1227,7 +1239,7 @@
46 pb.update('Parsing cvsps dump file.')
47 try:
48 parser = Parser(cvsps_dump_file, encoding=self._encoding)
49- patchsets = parser.parse(pb=pb)
50+ patchsets = parser.parse()
51 finally:
52 cvsps_dump_file.close()
53 return patchsets
54@@ -1274,7 +1286,7 @@
55 """Start converting the repository."""
56 pb = ui.ui_factory.nested_progress_bar()
57 try:
58- repo = self.open_or_create_bzr_repo(pb=pb)
59+ repo = self.open_or_create_bzr_repo()
60 finally:
61 pb.finished()
62 # Maintain a repository wide lock for the whole transaction

Subscribers

People subscribed via source and target branches

to all changes:
to status/vote changes: