Merge lp:~jelmer/brz/mark-0 into lp:brz

Proposed by Jelmer Vernooij
Status: Merged
Merged at revision: 6849
Proposed branch: lp:~jelmer/brz/mark-0
Merge into: lp:brz
Diff against target: 77 lines (+19/-1)
4 files modified
breezy/plugins/fastimport/cache_manager.py (+2/-0)
breezy/plugins/fastimport/processors/generic_processor.py (+5/-1)
breezy/plugins/fastimport/tests/test_generic_processor.py (+10/-0)
doc/en/release-notes/brz-3.0.txt (+2/-0)
To merge this branch: bzr merge lp:~jelmer/brz/mark-0
Reviewer Review Type Date Requested Status
Martin Packman Approve
Review via email: mp+336409@code.launchpad.net

Description of the change

Support the '0' marker in fastimport.

To post a comment you must log in.
Revision history for this message
Martin Packman (gz) wrote :

Sure, seems simple enough.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'breezy/plugins/fastimport/cache_manager.py'
2--- breezy/plugins/fastimport/cache_manager.py 2017-06-05 20:48:31 +0000
3+++ breezy/plugins/fastimport/cache_manager.py 2018-01-22 02:35:45 +0000
4@@ -124,7 +124,9 @@
5
6 def add_mark(self, mark, commit_id):
7 assert mark[0] != ':'
8+ is_new = (mark in self.marks)
9 self.marks[mark] = commit_id
10+ return is_new
11
12 def lookup_committish(self, committish):
13 """Resolve a 'committish' to a revision id.
14
15=== modified file 'breezy/plugins/fastimport/processors/generic_processor.py'
16--- breezy/plugins/fastimport/processors/generic_processor.py 2017-06-10 16:40:42 +0000
17+++ breezy/plugins/fastimport/processors/generic_processor.py 2018-01-22 02:35:45 +0000
18@@ -25,6 +25,7 @@
19 errors,
20 osutils,
21 progress,
22+ revision as _mod_revision,
23 )
24 from ....bzr.knitpack_repo import KnitPackRepository
25 from ....trace import (
26@@ -466,7 +467,7 @@
27
28 def _init_id_map(self):
29 """Load the id-map and check it matches the repository.
30-
31+
32 :return: the number of entries in the map
33 """
34 # Currently, we just check the size. In the future, we might
35@@ -474,6 +475,9 @@
36 # are identical as well.
37 self.cache_mgr.marks, known = idmapfile.load_id_map(
38 self.id_map_path)
39+ if self.cache_mgr.add_mark('0', _mod_revision.NULL_REVISION):
40+ known += 1
41+
42 existing_count = len(self.repo.all_revision_ids())
43 if existing_count < known:
44 raise plugin_errors.BadRepositorySize(known, existing_count)
45
46=== modified file 'breezy/plugins/fastimport/tests/test_generic_processor.py'
47--- breezy/plugins/fastimport/tests/test_generic_processor.py 2017-11-12 20:07:32 +0000
48+++ breezy/plugins/fastimport/tests/test_generic_processor.py 2018-01-22 02:35:45 +0000
49@@ -231,6 +231,16 @@
50 handler.process(self.file_command_iter(path))
51
52
53+class TestImportZeroMarker(TestCaseForGenericProcessor):
54+
55+ def test_tag(self):
56+ handler, branch = self.get_handler()
57+ def command_list():
58+ committer = ['', 'elmer@a.com', time.time(), time.timezone]
59+ yield commands.TagCommand('tag1', ':0', committer, "tag 1")
60+ handler.process(command_list)
61+
62+
63 class TestImportToPackModify(TestCaseForGenericProcessor):
64
65 def file_command_iter(self, path, kind='file', content='aaa',
66
67=== modified file 'doc/en/release-notes/brz-3.0.txt'
68--- doc/en/release-notes/brz-3.0.txt 2018-01-14 05:14:06 +0000
69+++ doc/en/release-notes/brz-3.0.txt 2018-01-22 02:35:45 +0000
70@@ -155,6 +155,8 @@
71 * It is now possible to version files with backslashes in their name
72 on platforms that support it. (Jelmer Vernooij, #81844)
73
74+* Support '0' markers in fastimport plugin. (Jelmer Vernooij, #1744615)
75+
76 Documentation
77 *************
78

Subscribers

People subscribed via source and target branches