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
=== modified file 'breezy/git/mapping.py'
--- breezy/git/mapping.py 2022-01-12 23:40:12 +0000
+++ breezy/git/mapping.py 2022-01-16 18:17:01 +0000
@@ -367,9 +367,11 @@
367 i += 1367 i += 1
368 propname = u'git-mergetag-%d' % i368 propname = u'git-mergetag-%d' % i
369 if u'git-extra' in rev.properties:369 if u'git-extra' in rev.properties:
370 commit.extra.extend(370 for l in rev.properties['git-extra'].splitlines():
371 [l.split(b' ', 1)371 (k, v) = l.split(' ', 1)
372 for l in rev.properties[u'git-extra'].splitlines()])372 commit.extra.append(
373 (k.encode('utf-8', 'surrogateescape'),
374 v.encode('utf-8', 'surrogateescape')))
373 return commit375 return commit
374376
375 def get_revision_id(self, commit):377 def get_revision_id(self, commit):
@@ -460,12 +462,16 @@
460 extra_lines = []462 extra_lines = []
461 for k, v in commit.extra:463 for k, v in commit.extra:
462 if k == HG_RENAME_SOURCE:464 if k == HG_RENAME_SOURCE:
463 extra_lines.append(k + b' ' + v + b'\n')465 extra_lines.append(
466 k.decode('utf-8', 'surrogateescape') + ' ' +
467 v.decode('utf-8', 'surrogateescape') + '\n')
464 elif k == HG_EXTRA:468 elif k == HG_EXTRA:
465 hgk, hgv = v.split(b':', 1)469 hgk, hgv = v.split(b':', 1)
466 if hgk not in (HG_EXTRA_AMEND_SOURCE, ) and strict:470 if hgk not in (HG_EXTRA_AMEND_SOURCE, ) and strict:
467 raise UnknownMercurialCommitExtra(commit, [hgk])471 raise UnknownMercurialCommitExtra(commit, [hgk])
468 extra_lines.append(k + b' ' + v + b'\n')472 extra_lines.append(
473 k.decode('utf-8', 'surrogateescape') + ' ' +
474 v.decode('utf-8', 'surrogateescape') + '\n')
469 else:475 else:
470 unknown_extra_fields.append(k)476 unknown_extra_fields.append(k)
471 if unknown_extra_fields and strict:477 if unknown_extra_fields and strict:
@@ -473,7 +479,7 @@
473 commit,479 commit,
474 [f.decode('ascii', 'replace') for f in unknown_extra_fields])480 [f.decode('ascii', 'replace') for f in unknown_extra_fields])
475 if extra_lines:481 if extra_lines:
476 rev.properties[u'git-extra'] = b''.join(extra_lines)482 rev.properties['git-extra'] = ''.join(extra_lines)
477 return rev, roundtrip_revid, verifiers483 return rev, roundtrip_revid, verifiers
478484
479485
@@ -482,7 +488,7 @@
482 experimental = False488 experimental = False
483489
484 def __str__(self):490 def __str__(self):
485 return self.revid_prefix491 return self.revid_prefix.decode('utf-8')
486492
487493
488class BzrGitMappingExperimental(BzrGitMappingv1):494class BzrGitMappingExperimental(BzrGitMappingv1):

Subscribers

People subscribed via source and target branches