Merge lp:bzr-hg into lp:~launchpad-pqm/bzr-hg/devel

Proposed by Aaron Bentley
Status: Merged
Merged at revision: 282
Proposed branch: lp:bzr-hg
Merge into: lp:~launchpad-pqm/bzr-hg/devel
Diff against target: 729 lines (+257/-65)
17 files modified
Makefile (+3/-11)
NEWS (+21/-1)
README (+12/-0)
__init__.py (+48/-7)
branch.py (+19/-10)
commands.py (+55/-0)
fetch.py (+6/-4)
idmap.py (+2/-2)
info.py (+2/-2)
mapping.py (+8/-4)
parsers.py (+8/-5)
repository.py (+6/-1)
setup.py (+1/-1)
tests/__init__.py (+9/-2)
tests/test_dir.py (+42/-0)
tests/test_mapping.py (+1/-1)
tests/test_parsers.py (+14/-14)
To merge this branch: bzr merge lp:bzr-hg
Reviewer Review Type Date Requested Status
Launchpad code reviewers from Canonical Pending
Review via email: mp+31876@code.launchpad.net

Commit message

Update to branch tip for bzr 2.2 compatibility

Description of the change

Update to trunk tip for compatibility with bzr 2.2

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile'
2--- Makefile 2009-11-01 16:37:38 +0000
3+++ Makefile 2010-08-05 19:14:41 +0000
4@@ -22,16 +22,8 @@
5 $(SETUP) clean
6 rm -f *.so
7
8-TMP_PLUGINS_DIR = $(shell pwd)/.plugins
9-
10-$(TMP_PLUGINS_DIR):
11- mkdir -p $@
12-
13-$(TMP_PLUGINS_DIR)/hg: $(TMP_PLUGINS_DIR)
14- ln -sf .. $@
15-
16-check:: build-inplace $(TMP_PLUGINS_DIR)/hg
17- BZR_PLUGIN_PATH=$(TMP_PLUGINS_DIR) $(DEBUGGER) $(PYTHON) $(PYTHON_OPTIONS) $(BZR) $(BZR_OPTIONS) selftest $(TEST_OPTIONS) $(TESTS)
18+check:: build-inplace
19+ BZR_PLUGINS_AT=hg@$(shell pwd) $(DEBUGGER) $(PYTHON) $(PYTHON_OPTIONS) $(BZR) $(BZR_OPTIONS) selftest $(TEST_OPTIONS) $(TESTS)
20
21 check-verbose::
22 $(MAKE) check TEST_OPTIONS=-v
23@@ -43,7 +35,7 @@
24 $(MAKE) check TEST_OPTIONS="--random=now --verbose --one"
25
26 show-plugins::
27- BZR_PLUGIN_PATH=$(TMP_PLUGINS_DIR) $(BZR) plugins
28+ BZR_PLUGINS_AT=hg@$(shell pwd) $(BZR) plugins -v
29
30 lint::
31 $(PYLINT) -f parseable *.py */*.py
32
33=== modified file 'NEWS'
34--- NEWS 2010-01-06 02:59:22 +0000
35+++ NEWS 2010-08-05 19:14:41 +0000
36@@ -21,6 +21,9 @@
37
38 * Add extra constraints in sqlite cache. (Jelmer Vernooij)
39
40+ * New 'bzr hg-import' command similar to 'bzr svn-import' and
41+ 'bzr git-import'. (Jelmer Vernooij)
42+
43 BUG FIXES
44
45 * Mark as compatible with Bazaar 2.1. (Jelmer Vernooij)
46@@ -32,13 +35,30 @@
47
48 * Remove empty directories during fetch. (Jelmer Vernooij)
49
50- * Mark Mercurial 1.4 as supported. (#486899, Jelmer Vernooij)
51+ * Mark Mercurial 1.4 and 1.5 as supported. (#486899, Jelmer Vernooij)
52
53 * Don't warn about development versions of Mercurial. (#492292, Jelmer
54 Vernooij)
55
56 * Cope with unusual characters in changeset ids. (#498945, Jelmer Vernooij)
57
58+ * Only mention Mercurial version to use yet. (#517345, Jelmer Vernooij)
59+
60+ * Only consider major version numbers in compatibility checks.
61+ (#517343, Jelmer Vernooij)
62+
63+ * Cope with non-ascii characters in committer names, messages when
64+ trying to create delta bases. (Jelmer Vernooij)
65+
66+ * Fix conversion of symlinks. (#594335, Max Bowser)
67+
68+ * Don't allow probing for Mercurial repositories over HTTP to break
69+ bzr. (Jelmer Vernooij)
70+
71+ DOCUMENTATION
72+
73+ * Add some basic instructions in INSTALL. (Martin Pool)
74+
75 0.1.0 2009-09-24
76
77 Initial release.
78
79=== modified file 'README'
80--- README 2009-09-03 11:12:21 +0000
81+++ README 2010-08-05 19:14:41 +0000
82@@ -4,3 +4,15 @@
83
84 This plugin requires recent versions of Bazaar and Mercurial to be
85 installed to work.
86+
87+To install::
88+
89+ bzr branch lp:bzr-hg ~/.bazaar/plugins/hg
90+
91+To use:
92+
93+* Use bzr in folders with Mercurial repositories. (Readonly commands only.)
94+
95+* Use ``bzr send --format hg``
96+
97+* Use ``-r hg:SPEC`` to look up Mercurial native revisions.
98
99=== modified file '__init__.py'
100--- __init__.py 2009-12-20 03:17:42 +0000
101+++ __init__.py 2010-08-05 19:14:41 +0000
102@@ -44,9 +44,14 @@
103 format_registry as send_format_registry,
104 )
105
106+_mercurial_loaded = False
107 LockWarner = bzrlib.lockable_files._LockWarner
108
109 def lazy_load_mercurial():
110+ global _mercurial_loaded
111+ if _mercurial_loaded:
112+ return
113+ _mercurial_loaded = True
114 import mercurial
115 try:
116 from mercurial import demandimport
117@@ -54,7 +59,8 @@
118 except ImportError:
119 pass
120 from mercurial.__version__ import version as hg_version
121- if hg_version not in hg_compatible_versions and not "+" in hg_version:
122+ hg_major_version = ".".join(hg_version.split(".")[:2])
123+ if hg_major_version not in hg_compatible_versions and not "+" in hg_version:
124 raise errors.DependencyNotPresent("mercurial",
125 'bzr-hg: Mercurial version %s not supported.' % hg_version)
126 trace.mutter("bzr-hg: using Mercurial %s" % hg_version)
127@@ -157,9 +163,9 @@
128 result._hgrepo.pull(self._hgrepo)
129 return result
130
131- def create_branch(self):
132+ def create_branch(self, name=None):
133 """'create' a branch for this dir."""
134- return self.open_branch()
135+ return self.open_branch(name=name)
136
137 def create_repository(self, shared=False):
138 """'create' a repository for this dir."""
139@@ -168,11 +174,29 @@
140 raise errors.IncompatibleFormat(self._format, self._format)
141 return self.open_repository()
142
143- def create_workingtree(self, shared=False):
144+ def create_workingtree(self, revision_id=None, from_branch=None,
145+ accelerator_tree=None, hardlink=False):
146 """'create' a workingtree for this dir."""
147+ if revision_id is not None:
148+ raise NotImplementedError("revision_id argument not yet supported")
149+ if from_branch is not None:
150+ raise NotImplementedError("from_branch argument not yet supported")
151 return self.open_workingtree()
152
153- def get_branch_transport(self, branch_format):
154+ def destroy_branch(self, name=None):
155+ if name is not None:
156+ raise errors.NoColocatedBranchSupport(self)
157+ raise errors.UnsupportedOperation(self.destroy_branch, self)
158+
159+ def destroy_workingtree(self):
160+ raise errors.UnsupportedOperation(self.destroy_workingtree, self)
161+
162+ def destroy_repository(self):
163+ raise errors.UnsupportedOperation(self.destroy_repository, self)
164+
165+ def get_branch_transport(self, branch_format, name=None):
166+ if name is not None:
167+ raise errors.NoColocatedBranchSupport(self)
168 if branch_format is None:
169 return self.transport
170 if isinstance(branch_format, HgBzrDirFormat):
171@@ -188,8 +212,10 @@
172 def needs_format_conversion(self, format=None):
173 return (format is not HgBzrDirFormat)
174
175- def open_branch(self, ignored=None):
176- """'crate' a branch for this dir."""
177+ def open_branch(self, name=None, ignored=None, unsupported=False):
178+ """'create' a branch for this dir."""
179+ if name is not None:
180+ raise errors.NoColocatedBranchSupport(self)
181 from bzrlib.plugins.hg.branch import HgLocalBranch, HgRemoteBranch
182 if self._hgrepo.local():
183 branch_klass = HgLocalBranch
184@@ -247,6 +273,9 @@
185 """We should write a converter."""
186 return HgToSomethingConverter(format)
187
188+ def network_name(self):
189+ return "hg"
190+
191 def get_format_description(self):
192 return "Mercurial Branch"
193
194@@ -254,6 +283,9 @@
195 """Initialize a new .not dir in the base directory of a Transport."""
196 return self.open(transport, _create=True)
197
198+ def __eq__(self, other):
199+ return type(self) == type(other)
200+
201 @classmethod
202 def _known_formats(self):
203 return set([HgBzrDirFormat()])
204@@ -291,6 +323,7 @@
205 # Explicitly check for .hg directories here, so we avoid
206 # loading foreign branches through Mercurial.
207 raise errors.NotBranchError(path=transport.base)
208+ import urllib2
209 try:
210 format.open(transport)
211 except hg_errors.RepoError, e:
212@@ -298,6 +331,9 @@
213 except hg_errors.Abort, e:
214 trace.mutter('not a hg branch: %s', e)
215 raise errors.NotBranchError(path=transport.base)
216+ except urllib2.HTTPError, e:
217+ trace.mutter('not a hg branch: %s', e)
218+ raise errors.NotBranchError(path=transport.base)
219 return format
220
221
222@@ -313,6 +349,11 @@
223 revspec_registry.register_lazy("hg:", "bzrlib.plugins.hg.revspec",
224 "RevisionSpec_hg")
225
226+from bzrlib.commands import (
227+ plugin_cmds,
228+ )
229+plugin_cmds.register_lazy('cmd_hg_import', [], 'bzrlib.plugins.hg.commands')
230+
231 try:
232 from bzrlib.revisionspec import dwim_revspecs
233 except ImportError:
234
235=== modified file 'branch.py'
236--- branch.py 2009-12-12 21:47:15 +0000
237+++ branch.py 2010-08-05 19:14:41 +0000
238@@ -104,6 +104,18 @@
239 return "long"
240
241
242+class HgReadLock(object):
243+
244+ def __init__(self, unlock):
245+ self.unlock = unlock
246+
247+
248+class HgWriteLock(object):
249+
250+ def __init__(self, unlock):
251+ self.unlock = unlock
252+
253+
254 class HgBranch(ForeignBranch):
255 """An adapter to mercurial repositories for bzr Branch objects."""
256
257@@ -152,6 +164,7 @@
258
259 def lock_write(self):
260 self.control_files.lock_write()
261+ return HgWriteLock(self.unlock)
262
263 @needs_read_lock
264 def revision_history(self):
265@@ -161,6 +174,7 @@
266
267 def lock_read(self):
268 self.control_files.lock_read()
269+ return HgReadLock(self.unlock)
270
271 def is_locked(self):
272 return self.control_files.is_locked()
273@@ -168,11 +182,6 @@
274 def unlock(self):
275 self.control_files.unlock()
276
277- def clone(self, to_bzrdir, revision_id=None):
278- # hg repositories can only clone into hg repos.
279- # and have nothing to do as we follow the hg model.
280- return to_bzrdir.open_branch()
281-
282 def get_stacked_on_url(self):
283 raise errors.UnstackableBranchFormat(self._format, self.base)
284
285@@ -208,7 +217,7 @@
286
287 @staticmethod
288 def _get_branch_formats_to_test():
289- return None, None
290+ return []
291
292 @staticmethod
293 def is_compatible(source, target):
294@@ -233,11 +242,11 @@
295 result = BranchPushResult()
296 result.source_branch = self.source
297 result.target_branch = self.target
298- result.old_revid = self.target.last_revision()
299+ result.old_revno, result.old_revid = self.target.last_revision_info()
300 inter = InterRepository.get(self.source.repository,
301 self.target.repository)
302 inter.fetch(revision_id=stop_revision)
303- result.new_revid = self.target.last_revision()
304+ result.new_revno, result.new_revid = self.target.last_revision_info()
305 return result
306
307
308@@ -249,7 +258,7 @@
309
310 @staticmethod
311 def _get_branch_formats_to_test():
312- return None, None
313+ return []
314
315 @staticmethod
316 def is_compatible(source, target):
317@@ -317,7 +326,7 @@
318
319 @staticmethod
320 def _get_branch_formats_to_test():
321- return None, None
322+ return []
323
324 @classmethod
325 def is_compatible(self, source, target):
326
327=== added file 'commands.py'
328--- commands.py 1970-01-01 00:00:00 +0000
329+++ commands.py 2010-08-05 19:14:41 +0000
330@@ -0,0 +1,55 @@
331+# Copyright (C) 2010 Jelmer Vernooij <jelmer@samba.org>
332+#
333+# This program is free software; you can redistribute it and/or modify
334+# it under the terms of the GNU General Public License as published by
335+# the Free Software Foundation; either version 2 of the License, or
336+# (at your option) any later version.
337+#
338+# This program is distributed in the hope that it will be useful,
339+# but WITHOUT ANY WARRANTY; without even the implied warranty of
340+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
341+# GNU General Public License for more details.
342+#
343+# You should have received a copy of the GNU General Public License
344+# along with this program; if not, write to the Free Software
345+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
346+
347+
348+"""Commands specific to dealing with Mercurial branches."""
349+
350+
351+from bzrlib import (
352+ errors,
353+ )
354+from bzrlib.commands import (
355+ Command,
356+ )
357+
358+import os
359+
360+
361+class cmd_hg_import(Command):
362+ """Convert a Mercurial repository to a Bazaar repository.
363+
364+ """
365+ _see_also = ['formats']
366+ takes_args = ['from_location', 'to_location?']
367+
368+ def run(self, from_location, to_location=None):
369+ from bzrlib.bzrdir import BzrDir
370+ if to_location is None:
371+ to_location = os.path.basename(from_location.rstrip("/\\"))
372+ from_dir = BzrDir.open(from_location)
373+ try:
374+ to_dir = BzrDir.open(to_location)
375+ except errors.NotBranchError:
376+ to_dir = BzrDir.create(to_location)
377+ try:
378+ to_repo = to_dir.open_repository()
379+ except errors.NoRepositoryPresent:
380+ to_repo = to_dir.create_repository()
381+ try:
382+ to_branch = to_dir.open_branch()
383+ except errors.NotBranchError:
384+ to_branch = to_dir.create_branch()
385+ to_branch.pull(from_dir.open_branch())
386
387=== modified file 'fetch.py'
388--- fetch.py 2009-12-18 21:43:34 +0000
389+++ fetch.py 2010-08-05 19:14:41 +0000
390@@ -357,9 +357,11 @@
391 key = (fileid, revision)
392 if kind == "symlink":
393 self._symlink_targets[key] = fulltext
394- fulltext = ""
395- record = FulltextContentFactory(key, [(fileid, p) for p in parents], osutils.sha_string(fulltext), fulltext)
396- self._text_metadata[key] = (record.sha1, len(fulltext))
397+ bzr_fulltext = ""
398+ else:
399+ bzr_fulltext = fulltext
400+ record = FulltextContentFactory(key, [(fileid, p) for p in parents], osutils.sha_string(bzr_fulltext), bzr_fulltext)
401+ self._text_metadata[key] = (record.sha1, len(bzr_fulltext))
402 yield record
403
404 def _add_inventories(self, todo, mapping, pb):
405@@ -484,7 +486,7 @@
406 revisions = filetext_map[fileid][node]
407 tp = self._find_most_recent_ancestor(revisions.keys(), revid)
408 text_parents.append(tp)
409- elif path2id(fileid) == path:
410+ elif path2id(path) == fileid:
411 # FIXME: Handle situation where path is not actually in parent
412 text_parents.append(parent[fileid].revision)
413 filetext_map[fileid][manifest[path]][revid] = (kind, text_parents)
414
415=== modified file 'idmap.py'
416--- idmap.py 2010-01-06 02:59:22 +0000
417+++ idmap.py 2010-08-05 19:14:41 +0000
418@@ -219,8 +219,8 @@
419
420 def revids(self):
421 ret = set()
422- for row in self.db.execute("select revid from revision").fetchall():
423- ret.add(row[0])
424+ ret.update((row for
425+ (row,) in self.db.execute("select revid from revision")))
426 return ret
427
428 def insert_revision(self, revid, manifest_id, changeset_id, mapping):
429
430=== modified file 'info.py'
431--- info.py 2010-01-04 16:18:04 +0000
432+++ info.py 2010-08-05 19:14:41 +0000
433@@ -1,7 +1,7 @@
434 bzr_plugin_name = 'hg'
435
436 bzr_compatible_versions = [(1, x, 0) for x in [13, 14, 15, 16, 17, 18]] + \
437- [(2, x, 0) for x in [0, 1]]
438+ [(2, x, 0) for x in [0, 1, 2]]
439
440 bzr_minimum_version = bzr_compatible_versions[0]
441
442@@ -11,4 +11,4 @@
443
444 bzr_control_formats = {"Mercurial": {'.hg/': None}}
445
446-hg_compatible_versions = ["1.3.1", "1.4", "1.4.1", "1.4.2"]
447+hg_compatible_versions = ["1.3", "1.4", "1.5", "1.6"]
448
449=== modified file 'mapping.py'
450--- mapping.py 2009-11-26 21:33:32 +0000
451+++ mapping.py 2010-08-05 19:14:41 +0000
452@@ -288,7 +288,7 @@
453 return unescape_path(fileid[len("hg:"):])
454
455 def export_revision(self, rev, lossy=True, fileids={}):
456- user = rev.committer.encode("utf-8")
457+ user = rev.committer
458 time = rev.timestamp
459 timezone = -rev.timezone
460 extra = {}
461@@ -320,18 +320,22 @@
462 extra["bzr-extra-parents"] = " ".join(rev.parent_ids[2:])
463 if fileids:
464 extra["bzr-fileids"] = bencode.bencode(sorted(fileids.items()))
465- desc = rev.message.encode("utf-8")
466+ desc = rev.message
467 return (manifest, user, (time, timezone), desc, extra)
468
469 def import_revision(self, revid, parent_ids, hgrevid, manifest, user,
470 (time, timezone), desc, extra):
471 result = foreign.ForeignRevision(hgrevid, self, revid)
472 result.parent_ids = parent_ids
473- result.message = desc.decode("utf-8")
474+ if type(desc) != unicode:
475+ raise AssertionError
476+ result.message = desc
477 result.inventory_sha1 = ""
478 result.timezone = -timezone
479 result.timestamp = time
480- result.committer = user.decode("utf-8")
481+ if type(user) != unicode:
482+ raise AssertionError
483+ result.committer = user
484 result.properties = {
485 'manifest': mercurial.node.hex(manifest)
486 }
487
488=== modified file 'parsers.py'
489--- parsers.py 2009-11-26 21:33:32 +0000
490+++ parsers.py 2010-08-05 19:14:41 +0000
491@@ -25,7 +25,6 @@
492 """
493
494 import mercurial.changelog
495-import mercurial.encoding
496 import mercurial.manifest
497 import mercurial.mdiff
498 import mercurial.node
499@@ -55,9 +54,13 @@
500 raise ValueError("empty username")
501 if "\n" in user:
502 raise ValueError("username %s contains a newline" % repr(user))
503+ if type(user) != unicode:
504+ raise TypeError("user should be unicode string")
505+ if type(desc) != unicode:
506+ raise TypeError("desc should be unicode string")
507
508- user = mercurial.encoding.fromlocal(user)
509- desc = mercurial.encoding.fromlocal(desc)
510+ user = user.encode("utf-8")
511+ desc = desc.encode("utf-8")
512
513 if not isinstance(date, tuple):
514 raise TypeError("date is not a tuple")
515@@ -79,10 +82,10 @@
516 :return: Tuple with (manifest, user, (time, timezone), files, desc, extra)
517 """
518 last = text.index("\n\n")
519- desc = mercurial.encoding.tolocal(text[last + 2:])
520+ desc = text[last + 2:].decode("utf-8")
521 l = text[:last].split('\n')
522 manifest = mercurial.node.bin(l[0])
523- user = mercurial.encoding.tolocal(l[1])
524+ user = l[1].decode("utf-8")
525
526 extra_data = l[2].split(' ', 2)
527 if len(extra_data) != 3:
528
529=== modified file 'repository.py'
530--- repository.py 2009-12-15 20:34:14 +0000
531+++ repository.py 2010-08-05 19:14:41 +0000
532@@ -63,6 +63,9 @@
533 """
534 rich_root_data = True
535
536+ def initialize(self, url, shared=False, _internal=False):
537+ raise errors.UninitializableFormat(self)
538+
539 def is_supported(self):
540 return True
541
542@@ -338,6 +341,7 @@
543
544 def lookup_bzr_revision_id(self, revision_id):
545 """See ForeignRepository.lookup_bzr_revision_id()."""
546+ assert type(revision_id) is str
547 # TODO: Handle round-tripped revisions
548 try:
549 return mapping_registry.revision_id_bzr_to_foreign(revision_id)
550@@ -345,11 +349,12 @@
551 raise errors.NoSuchRevision(self, revision_id)
552
553 def get_revision(self, revision_id):
554+ assert type(revision_id) is str
555 hgrevid, mapping = self.lookup_bzr_revision_id(revision_id)
556 hgchange = self._hgrepo.changelog.read(hgrevid)
557 hgparents = self._hgrepo.changelog.parents(hgrevid)
558 parent_ids = as_bzr_parents(hgparents, self.lookup_foreign_revision_id)
559- return mapping.import_revision(revision_id, parent_ids, hgrevid, hgchange[0], hgchange[1], hgchange[2], hgchange[4], hgchange[5])[0]
560+ return mapping.import_revision(revision_id, parent_ids, hgrevid, hgchange[0], hgchange[1].decode("utf-8"), hgchange[2], hgchange[4].decode("utf-8"), hgchange[5])[0]
561
562 def iter_inventories(self, revision_ids, ordering=None):
563 for revid in revision_ids:
564
565=== modified file 'setup.py'
566--- setup.py 2009-11-26 21:33:32 +0000
567+++ setup.py 2010-08-05 19:14:41 +0000
568@@ -19,5 +19,5 @@
569 Mercurial branches in Bazaar.
570 """,
571 package_dir={'bzrlib.plugins.hg':'.'},
572- packages=['bzrlib.plugins.hg']
573+ packages=['bzrlib.plugins.hg', 'bzrlib.plugins.hg.tests']
574 )
575
576=== modified file 'tests/__init__.py'
577--- tests/__init__.py 2009-10-14 21:02:20 +0000
578+++ tests/__init__.py 2010-08-05 19:14:41 +0000
579@@ -23,8 +23,15 @@
580
581 suite = TestSuite()
582
583- testmod_names = ['test_branch', 'test_idmap', 'test_mapping', 'test_parsers', 'test_pull']
584-
585+ testmod_names = [
586+ 'test_branch',
587+ 'test_dir',
588+ 'test_idmap',
589+ 'test_mapping',
590+ 'test_parsers',
591+ 'test_pull',
592+ ]
593+
594 suite.addTest(loader.loadTestsFromModuleNames(["%s.%s" % (__name__, i) for i in testmod_names]))
595
596 return suite
597
598=== added file 'tests/test_dir.py'
599--- tests/test_dir.py 1970-01-01 00:00:00 +0000
600+++ tests/test_dir.py 2010-08-05 19:14:41 +0000
601@@ -0,0 +1,42 @@
602+# Copyright (C) 2010 Jelmer Vernooij <jelmer@samba.org>
603+
604+# This program is free software; you can redistribute it and/or modify
605+# it under the terms of the GNU General Public License as published by
606+# the Free Software Foundation; either version 2 of the License, or
607+# (at your option) any later version.
608+
609+# This program is distributed in the hope that it will be useful,
610+# but WITHOUT ANY WARRANTY; without even the implied warranty of
611+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
612+# GNU General Public License for more details.
613+
614+# You should have received a copy of the GNU General Public License
615+# along with this program; if not, write to the Free Software
616+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
617+
618+from bzrlib.bzrdir import (
619+ format_registry,
620+ )
621+
622+from bzrlib.tests import (
623+ TestCase,
624+ )
625+
626+from bzrlib.plugins.hg import (
627+ HgBzrDirFormat,
628+ )
629+
630+
631+class HgBzrDirFormatTests(TestCase):
632+
633+ def test_eq(self):
634+ format1 = HgBzrDirFormat()
635+ format2 = HgBzrDirFormat()
636+ self.assertEquals(format1, format2)
637+ self.assertEquals(format1, format1)
638+ bzr_format = format_registry.make_bzrdir("default")
639+ self.assertNotEquals(bzr_format, format1)
640+
641+ def test_network_name(self):
642+ format = HgBzrDirFormat()
643+ self.assertEquals("hg", format.network_name())
644
645=== modified file 'tests/test_mapping.py'
646--- tests/test_mapping.py 2009-11-16 23:06:52 +0000
647+++ tests/test_mapping.py 2010-08-05 19:14:41 +0000
648@@ -121,7 +121,7 @@
649 self.mapping.export_revision(rev)
650 self.assertEquals("Jelmer <foo>", user)
651 self.assertEquals(None, manifest)
652- self.assertEquals("ürk", desc)
653+ self.assertEquals(u"ürk", desc)
654 self.assertEquals({"bzr-revprop-something": "else", "foo": "bar"},
655 extra)
656
657
658=== modified file 'tests/test_parsers.py'
659--- tests/test_parsers.py 2009-10-10 12:19:36 +0000
660+++ tests/test_parsers.py 2010-08-05 19:14:41 +0000
661@@ -36,8 +36,8 @@
662 commit
663 message""",
664 format_changeset(mercurial.node.nullid, ["myfile"],
665- "Jelmer Vernooij <jelmer@samba.org>",
666- (1253260798.0, -7200), "Some\ncommit\nmessage",
667+ u"Jelmer Vernooij <jelmer@samba.org>",
668+ (1253260798.0, -7200), u"Some\ncommit\nmessage",
669 {}))
670
671 def test_extra(self):
672@@ -50,27 +50,27 @@
673 commit
674 message""",
675 format_changeset(mercurial.node.nullid, ["myfile"],
676- "Jelmer Vernooij <jelmer@samba.org>",
677- (1253260798.0, -7200), "Some\ncommit\nmessage",
678+ u"Jelmer Vernooij <jelmer@samba.org>",
679+ (1253260798.0, -7200), u"Some\ncommit\nmessage",
680 {"extra": "data", "more":"extra"}))
681
682 def test_invalid_author(self):
683 self.assertRaises(ValueError, format_changeset,
684 mercurial.node.nullid, ["myfile"],
685- "",
686- (1253260798.0, -7200), "Some\ncommit\nmessage",
687+ u"",
688+ (1253260798.0, -7200), u"Some\ncommit\nmessage",
689 {})
690 self.assertRaises(ValueError, format_changeset,
691 mercurial.node.nullid, ["myfile"],
692- "Jelmer\nVernooij",
693- (1253260798.0, -7200), "Some\ncommit\nmessage",
694+ u"Jelmer\nVernooij",
695+ (1253260798.0, -7200), u"Some\ncommit\nmessage",
696 {})
697
698 def test_invalid_date(self):
699 self.assertRaises(TypeError, format_changeset,
700 mercurial.node.nullid, ["myfile"],
701- "Jelmer Vernooij <jelmer@samba.org>",
702- 1253260798, "Some\ncommit\nmessage",
703+ u"Jelmer Vernooij <jelmer@samba.org>",
704+ 1253260798, u"Some\ncommit\nmessage",
705 {})
706
707
708@@ -78,8 +78,8 @@
709
710 def test_simple(self):
711 self.assertEquals((mercurial.node.nullid,
712- "Jelmer Vernooij <jelmer@samba.org>",
713- (1253260798.0, -7200), ["myfile"], "Some\ncommit\nmessage",
714+ u"Jelmer Vernooij <jelmer@samba.org>",
715+ (1253260798.0, -7200), ["myfile"], u"Some\ncommit\nmessage",
716 {}), parse_changeset("""0000000000000000000000000000000000000000
717 Jelmer Vernooij <jelmer@samba.org>
718 1253260798 -7200
719@@ -91,8 +91,8 @@
720
721 def test_extra(self):
722 self.assertEquals((mercurial.node.nullid,
723- "Jelmer Vernooij <jelmer@samba.org>",
724- (1253260798.0, -7200), ["myfile"], "Some\ncommit\nmessage",
725+ u"Jelmer Vernooij <jelmer@samba.org>",
726+ (1253260798.0, -7200), ["myfile"], u"Some\ncommit\nmessage",
727 {"date": "extra"}),
728 parse_changeset("""0000000000000000000000000000000000000000
729 Jelmer Vernooij <jelmer@samba.org>

Subscribers

People subscribed via source and target branches