Merge lp:~jelmer/brz/git-extras into lp:brz/3.2

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: no longer in the source branch.
Merge reported by: The Breezy Bot
Merged at revision: not available
Proposed branch: lp:~jelmer/brz/git-extras
Merge into: lp:brz/3.2
Diff against target: 55 lines (+13/-7)
1 file modified
breezy/git/mapping.py (+13/-7)
To merge this branch: bzr merge lp:~jelmer/brz/git-extras
Reviewer Review Type Date Requested Status
Jelmer Vernooij Approve
Review via email: mp+414210@code.launchpad.net

Commit message

Fix handling of git-extra.

Description of the change

Fix handling of git-extra.

To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'breezy/git/mapping.py'
2--- breezy/git/mapping.py 2022-01-12 23:40:12 +0000
3+++ breezy/git/mapping.py 2022-01-16 18:17:01 +0000
4@@ -367,9 +367,11 @@
5 i += 1
6 propname = u'git-mergetag-%d' % i
7 if u'git-extra' in rev.properties:
8- commit.extra.extend(
9- [l.split(b' ', 1)
10- for l in rev.properties[u'git-extra'].splitlines()])
11+ for l in rev.properties['git-extra'].splitlines():
12+ (k, v) = l.split(' ', 1)
13+ commit.extra.append(
14+ (k.encode('utf-8', 'surrogateescape'),
15+ v.encode('utf-8', 'surrogateescape')))
16 return commit
17
18 def get_revision_id(self, commit):
19@@ -460,12 +462,16 @@
20 extra_lines = []
21 for k, v in commit.extra:
22 if k == HG_RENAME_SOURCE:
23- extra_lines.append(k + b' ' + v + b'\n')
24+ extra_lines.append(
25+ k.decode('utf-8', 'surrogateescape') + ' ' +
26+ v.decode('utf-8', 'surrogateescape') + '\n')
27 elif k == HG_EXTRA:
28 hgk, hgv = v.split(b':', 1)
29 if hgk not in (HG_EXTRA_AMEND_SOURCE, ) and strict:
30 raise UnknownMercurialCommitExtra(commit, [hgk])
31- extra_lines.append(k + b' ' + v + b'\n')
32+ extra_lines.append(
33+ k.decode('utf-8', 'surrogateescape') + ' ' +
34+ v.decode('utf-8', 'surrogateescape') + '\n')
35 else:
36 unknown_extra_fields.append(k)
37 if unknown_extra_fields and strict:
38@@ -473,7 +479,7 @@
39 commit,
40 [f.decode('ascii', 'replace') for f in unknown_extra_fields])
41 if extra_lines:
42- rev.properties[u'git-extra'] = b''.join(extra_lines)
43+ rev.properties['git-extra'] = ''.join(extra_lines)
44 return rev, roundtrip_revid, verifiers
45
46
47@@ -482,7 +488,7 @@
48 experimental = False
49
50 def __str__(self):
51- return self.revid_prefix
52+ return self.revid_prefix.decode('utf-8')
53
54
55 class BzrGitMappingExperimental(BzrGitMappingv1):

Subscribers

People subscribed via source and target branches