Merge lp:~germar/bzr-fastimport/bzr-fastimport into lp:bzr-fastimport

Proposed by Germar on 2015-10-14
Status: Needs review
Proposed branch: lp:~germar/bzr-fastimport/bzr-fastimport
Merge into: lp:bzr-fastimport
Diff against target: 33 lines (+11/-1)
1 file modified
exporter.py (+11/-1)
To merge this branch: bzr merge lp:~germar/bzr-fastimport/bzr-fastimport
Reviewer Review Type Date Requested Status
Bazaar Developers 2015-10-14 Pending
Review via email: mp+274480@code.launchpad.net

Description of the change

Inspired by http://www.fusonic.net/en/blog/2013/03/26/migrating-from-bazaar-to-git/ this will add the bug properties to the commit message if running with --plain. So you will not loose that information anymore if you export to GIT.

To post a comment you must log in.

Unmerged revisions

361. By Germar on 2015-10-14

write bug property into commit message if running with --plain

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'exporter.py'
2--- exporter.py 2014-05-15 09:26:03 +0000
3+++ exporter.py 2015-10-14 22:56:18 +0000
4@@ -422,10 +422,20 @@
5 from_ = None
6 merges = None
7
8+ message = revobj.message
9+
10 # Filter the revision properties. Some metadata (like the
11 # author information) is already exposed in other ways so
12 # don't repeat it here.
13 if self.plain_format:
14+ if 'bugs' in revobj.properties:
15+ m = re.match(r'(http.*/\d+)', revobj.properties['bugs'])
16+ if m:
17+ message += ' (fixed %s)' %m.group(1)
18+ if self.verbose:
19+ self.note('Added bug note to message: %s' %message)
20+ else:
21+ self.warning("Found bug property but wasn't able to extract link: %s" %revobj.properties['bugs'])
22 properties = None
23 else:
24 properties = revobj.properties
25@@ -437,7 +447,7 @@
26
27 # Build and return the result
28 return commands.CommitCommand(git_ref, mark, author_info,
29- committer_info, revobj.message.encode("utf-8"), from_, merges, iter(file_cmds),
30+ committer_info, message.encode("utf-8"), from_, merges, iter(file_cmds),
31 more_authors=more_author_info, properties=properties)
32
33 def _get_revision_trees(self, parent, revision_id):

Subscribers

People subscribed via source and target branches