Rev 18: Merge upstream in file:///home/jelmer/bzr-hg/debian/

Jelmer Vernooij jelmer at samba.org
Sat Jan 20 22:29:49 GMT 2007


------------------------------------------------------------
revno: 18
revision-id: jelmer at samba.org-20070120222939-4rb8p1epuphhdjq7
parent: jelmer at samba.org-20061014151418-1050de8bfa28a145
parent: jelmer at samba.org-20070120222342-wevij8cjm95s1qh7
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: debian
timestamp: Sat 2007-01-20 23:29:39 +0100
message:
  Merge upstream
added:
  README                         readme-20070120222318-hjs34p2pfb0iiztn-1
  TODO                           todo-20070120183318-j6t81mqw72195edi-1
  tests/                         tests-20070120191321-phuh769albgyal03-1
  tests/__init__.py              __init__.py-20070120191321-phuh769albgyal03-2
  tests/test_pull.py             test_pull.py-20070120191448-3e014gbhfpyq9d82-1
modified:
  __init__.py                    __init__.py-20060531211707-2fy7rwqqcmfgf8ve-1
  setup.py                       setup.py-20060706010156-paz07n490vbyvp96-1
    ------------------------------------------------------------
    revno: 16.1.10
    merged: jelmer at samba.org-20070120222342-wevij8cjm95s1qh7
    parent: jelmer at samba.org-20070120210104-i2jt3dbvaj1de1fr
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: jelmer
    timestamp: Sat 2007-01-20 23:23:42 +0100
    message:
      Add trivial README.
    ------------------------------------------------------------
    revno: 16.1.9
    merged: jelmer at samba.org-20070120210104-i2jt3dbvaj1de1fr
    parent: jelmer at samba.org-20070120195357-9ll5s1z5fhncrc2k
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: jelmer
    timestamp: Sat 2007-01-20 22:01:04 +0100
    message:
      Fix nickname test.
    ------------------------------------------------------------
    revno: 16.1.8
    merged: jelmer at samba.org-20070120195357-9ll5s1z5fhncrc2k
    parent: jelmer at samba.org-20070120192637-tanjc2qszob13p4k
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: jelmer
    timestamp: Sat 2007-01-20 20:53:57 +0100
    message:
      Fix executable bits after mercurial API changes.
    ------------------------------------------------------------
    revno: 16.1.7
    merged: jelmer at samba.org-20070120192637-tanjc2qszob13p4k
    parent: jelmer at samba.org-20070120192618-yllv3ij39dtfwloi
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: jelmer
    timestamp: Sat 2007-01-20 20:26:37 +0100
    message:
      Fix imports.
    ------------------------------------------------------------
    revno: 16.1.6
    merged: jelmer at samba.org-20070120192618-yllv3ij39dtfwloi
    parent: jelmer at samba.org-20070120191742-xm99e2qmvi3q7tqd
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: jelmer
    timestamp: Sat 2007-01-20 20:26:18 +0100
    message:
      Fix commit with more recent versions of mercurial.
    ------------------------------------------------------------
    revno: 16.1.5
    merged: jelmer at samba.org-20070120191742-xm99e2qmvi3q7tqd
    parent: jelmer at samba.org-20070120190039-9lqukuvyl3oezgkc
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: jelmer
    timestamp: Sat 2007-01-20 20:17:42 +0100
    message:
      Split out tests into a separate directory.
    ------------------------------------------------------------
    revno: 16.1.4
    merged: jelmer at samba.org-20070120190039-9lqukuvyl3oezgkc
    parent: jelmer at samba.org-20070120185436-xbz8tqmioq892e0u
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: jelmer
    timestamp: Sat 2007-01-20 20:00:39 +0100
    message:
      Fix copy-n-paste errors
    ------------------------------------------------------------
    revno: 16.1.3
    merged: jelmer at samba.org-20070120185436-xbz8tqmioq892e0u
    parent: jelmer at samba.org-20070120183559-snl1ntposrl07mu5
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: jelmer
    timestamp: Sat 2007-01-20 19:54:36 +0100
    message:
      Some more fixes based on Roberts' comments.
    ------------------------------------------------------------
    revno: 16.1.2
    merged: jelmer at samba.org-20070120183559-snl1ntposrl07mu5
    parent: jelmer at samba.org-20060927171820-805db70ece66b21a
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: jelmer
    timestamp: Sat 2007-01-20 19:35:59 +0100
    message:
      Fix some issues pointed out by Robert.
    ------------------------------------------------------------
    revno: 16.1.1
    merged: jelmer at samba.org-20060927171820-805db70ece66b21a
    parent: jelmer at samba.org-20060706010216-e5dcaf974a95ea79
    parent: robertc at robertcollins.net-20060925082522-3fe0da80233bd21e
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: bzr-hg-jelmer
    timestamp: Wed 2006-09-27 13:18:20 -0400
    message:
      [merge] Robert Collins
    ------------------------------------------------------------
    revno: 13.1.2
    merged: robertc at robertcollins.net-20060925082522-3fe0da80233bd21e
    parent: robertc at robertcollins.net-20060925072947-9f2eb882c913c8a3
    committer: Robert Collins <robertc at robertcollins.net>
    branch nick: trunk
    timestamp: Mon 2006-09-25 18:25:22 +1000
    message:
      (Robert Collins) Fix the hg plugin to work with current bzr viz from bzr-gtk.
    ------------------------------------------------------------
    revno: 13.1.1
    merged: robertc at robertcollins.net-20060925072947-9f2eb882c913c8a3
    parent: jelmer at samba.org-20060613142403-3c01fbe94bf0f475
    committer: Robert Collins <robertc at robertcollins.net>
    branch nick: trunk
    timestamp: Mon 2006-09-25 17:29:47 +1000
    message:
      Implement 'fetch with no specified revision and update the repo creation to work with bzr 0.11.'
=== added file 'README'
--- a/README	1970-01-01 00:00:00 +0000
+++ b/README	2007-01-20 22:23:42 +0000
@@ -0,0 +1,6 @@
+This plugin provides limited support for fetching revisions from 
+Mercurial in Bazaar. It supports reading a sufficient amount of 
+data for "bzr viz" to work against Mercurial branches.
+
+The plugin requires Mercurial 0.9.3 and a recent version of 
+Bazaar (tested with 0.13 and 0.14).

=== added file 'TODO'
--- a/TODO	1970-01-01 00:00:00 +0000
+++ b/TODO	2007-01-20 18:54:36 +0000
@@ -0,0 +1,4 @@
+- Call out to mercurial for consistency checking?
+- Obtain appropriate repository defaults in Branch.get_parent() and 
+  Branch.get_push_location()
+- Read hgrc in MercurialBranchConfig()

=== added directory 'tests'
=== added file 'tests/__init__.py'
--- a/tests/__init__.py	1970-01-01 00:00:00 +0000
+++ b/tests/__init__.py	2007-01-20 19:17:42 +0000
@@ -0,0 +1,30 @@
+# Copyright (C) 2006 Jelmer Vernooij <jelmer at samba.org>
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+def test_suite():
+    from unittest import TestSuite, TestLoader
+    
+    from bzrlib.tests import TestUtil
+
+    loader = TestUtil.TestLoader()
+
+    suite = TestSuite()
+
+    testmod_names = ['test_pull']
+            
+    suite.addTest(loader.loadTestsFromModuleNames(["%s.%s" % (__name__, i) for i in testmod_names]))
+
+    return suite

=== added file 'tests/test_pull.py'
--- a/tests/test_pull.py	1970-01-01 00:00:00 +0000
+++ b/tests/test_pull.py	2007-01-20 19:26:37 +0000
@@ -0,0 +1,138 @@
+# Copyright (C) 2005, 2006 Canonical Ltd
+# Copyright (C) 2006 Jelmer Vernooij <jelmer at samba.org>
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+from bzrlib.inventory import Inventory
+from bzrlib.plugins.hg import HgBzrDirFormat
+from bzrlib.tests import TestCaseWithTransport
+
+import copy
+import os
+import stat
+
+class TestPulling(TestCaseWithTransport):
+    """Tests for pulling from hg to bzr."""
+
+    def setUp(self):
+        super(TestPulling, self).setUp()
+        self.build_tree(['hg/', 'hg/a', 'hg/b', 'hg/dir/', 'hg/dir/c'])
+        hgdir = HgBzrDirFormat().initialize('hg')
+        self.tree = hgdir.open_workingtree()
+        mode = os.lstat('hg/b').st_mode
+        os.chmod('hg/b', mode | stat.S_IEXEC)
+        # do not add 'dir' to ensure that we pickup dir/c anyway : if hg
+        # changes it behaviour, we want this test to start failing.
+        self.tree.add(['a', 'b', 'dir/c'])
+        self.tree.commit('foo')
+        revone_inventory = Inventory()
+        tip = self.tree.last_revision()
+        entry = revone_inventory.add_path('a', kind='file', file_id='hg:a')
+        entry.revision = tip
+        entry.text_size = len('contents of hg/a\n')
+        entry.text_sha1 = "72bcea9d6cba6ee7d3241bfa0c5e54506ad81a94"
+        entry = revone_inventory.add_path('b', kind='file', file_id='hg:b')
+        entry.executable = True
+        entry.revision = tip
+        entry.text_size = len('contents of hg/b\n')
+        entry.text_sha1 = "b4d0c22d126cd0afeeeffa62961fb47c0932835a"
+        entry = revone_inventory.add_path('dir', kind='directory',
+            file_id='hg:dir')
+        entry.revision = tip
+        entry = revone_inventory.add_path('dir/c', kind='file',
+            file_id='hg:dir:c')
+        entry.revision = tip
+        entry.text_size = len('contents of hg/dir/c\n')
+        entry.text_sha1 = "958be752affac0fee70471331b96fb3fc1809425"
+        self.revone_inventory = revone_inventory
+        self.revidone = tip
+        #====== end revision one
+        self.build_tree(['hg/dir/d'])
+        self.tree.add(['dir/d'])
+        self.tree.commit('bar')
+        self.revtwo_inventory = copy.deepcopy(revone_inventory)
+        tip = self.tree.last_revision()
+        entry = self.revtwo_inventory.add_path('dir/d', kind='file',
+            file_id='hg:dir:d')
+        entry.revision = tip
+        entry.text_size = len('contents of hg/dir/d\n')
+        entry.text_sha1 = "f48fc342f707bfb4711790e1813c0df4d44e1a23"
+        self.revidtwo = tip
+        #====== end revision two
+        # in revision three, we reset the exec flag on 'b'
+        os.chmod('hg/b', mode)
+        self.tree.commit('reset mode on b')
+        self.revthree_inventory = copy.deepcopy(self.revtwo_inventory)
+        tip = self.tree.last_revision()
+        # should be a new file revision with exec reset
+        entry = self.revthree_inventory['hg:b']
+        entry.revision = tip
+        entry.executable = False
+        self.revidthree = tip
+
+    def test_inventory_from_manifest(self):
+        repo = self.tree.branch.repository
+        left = self.revone_inventory
+        right = repo.get_inventory(self.revidone)
+        self.assertEqual(left._byid, right._byid)
+        left = self.revtwo_inventory
+        right = repo.get_inventory(self.revidtwo)
+        self.assertEqual(left._byid, right._byid)
+        left = self.revthree_inventory
+        right = repo.get_inventory(self.revidthree)
+        self.assertEqual(left._byid, right._byid)
+
+    def test_initial_revision_from_changelog(self):
+        converted_rev = self.tree.branch.repository.get_revision(self.revidone)
+        self.assertEqual([], converted_rev.parent_ids)
+        self.assertEqual({}, converted_rev.properties)
+        self.assertEqual('foo', converted_rev.message)
+        self.assertEqual(self.revidone, converted_rev.revision_id)
+        # we dont have a serialised inventory to convert, and the inv sha1 is
+        # of reducing meaning now.
+        self.assertEqual("", converted_rev.inventory_sha1)
+        self.assertNotEqual(None, converted_rev.timestamp)
+        self.assertNotEqual(None, converted_rev.timezone)
+        self.assertNotEqual(None, converted_rev.committer)
+
+    def test_non_initial_revision_from_changelog(self):
+        converted_rev = self.tree.branch.repository.get_revision(self.revidtwo)
+        self.assertEqual([self.revidone], converted_rev.parent_ids)
+        self.assertEqual({}, converted_rev.properties)
+        self.assertEqual('bar', converted_rev.message)
+        self.assertEqual(self.revidtwo, converted_rev.revision_id)
+        # we dont have a serialised inventory to convert, and the inv sha1 is
+        # of reducing meaning now.
+        self.assertEqual("", converted_rev.inventory_sha1)
+        self.assertNotEqual(None, converted_rev.timestamp)
+        self.assertNotEqual(None, converted_rev.timezone)
+        self.assertNotEqual(None, converted_rev.committer)
+
+    def test_get_config_nickname(self):
+        # the branch nickname should be hg because the test dir is called hg.
+        self.assertEqual("hg", self.tree.branch.get_config().get_nickname())
+
+    def test_has_revision(self):
+        self.assertTrue(self.tree.branch.repository.has_revision(self.revidone))
+        self.assertTrue(self.tree.branch.repository.has_revision(self.revidtwo))
+        self.assertFalse(self.tree.branch.repository.has_revision('foo'))
+
+    def test_pull_into_bzr(self):
+        bzrtree = self.make_branch_and_tree('bzr')
+        bzrtree.pull(self.tree.branch)
+        self.assertFileEqual('contents of hg/a\n', 'bzr/a')
+        self.assertFileEqual('contents of hg/b\n', 'bzr/b')
+        self.assertFileEqual('contents of hg/dir/c\n', 'bzr/dir/c')
+ 

=== modified file '__init__.py'
--- a/__init__.py	2006-06-19 10:43:52 +0000
+++ b/__init__.py	2007-01-20 21:01:04 +0000
@@ -39,7 +39,6 @@
 
 import bzrlib.branch
 import bzrlib.bzrdir
-from bzrlib.config import TreeConfig
 from bzrlib.decorators import *
 import bzrlib.errors as errors
 from bzrlib.inventory import Inventory
@@ -47,9 +46,9 @@
 from bzrlib.osutils import split_lines, sha_strings
 import bzrlib.repository
 from bzrlib.revision import Revision
-from bzrlib.tests import TestLoader, TestCaseWithTransport
 from bzrlib.transport.local import LocalTransport
 from bzrlib.tsort import topo_sort
+import bzrlib.urlutils as urlutils
 import bzrlib.workingtree
 
 
@@ -90,17 +89,25 @@
         self._lock_count = 0
 
 
+class MercurialBranchConfig:
+    """Hg branch configuration."""
+
+    def __init__(self, branch):
+        # TODO: Read .hgrc
+        self.branch = branch
+
+
 class HgRepositoryFormat(bzrlib.repository.RepositoryFormat):
     """Mercurial Repository Format.
 
-    This is currently not aware of different working tree formats,
+    This is currently not aware of different repository formats,
     but simply relies on the installed copy of mercurial to 
-    support the working tree format.
+    support the repository format.
     """
 
     def get_format_description(self):
         """See RepositoryFormat.get_format_description()."""
-        return "Mercurial Repository Format"
+        return "Mercurial Repository"
 
 
 class HgRepository(bzrlib.repository.Repository):
@@ -111,6 +118,7 @@
         self.bzrdir = hgdir
         self.control_files = lockfiles
         self._format = HgRepositoryFormat()
+        self.base = hgdir.root_transport.base
 
     def _check(self, revision_ids):
         # TODO: Call out to mercurial for consistency checking?
@@ -142,7 +150,7 @@
         hgid = hgrevid_from_bzr(revision_id)
         log = self._hgrepo.changelog.read(hgid)
         manifest = self._hgrepo.manifest.read(log[0])
-        manifest_flags = self._hgrepo.manifest.readflags(log[0])
+        manifest_flags = self._hgrepo.manifest.read(log[0])
         all_relevant_revisions = self.get_revision_graph(revision_id)
         ancestry_cache = {}
         result = Inventory()
@@ -261,7 +269,7 @@
             # TODO: perhaps we should use readmeta here to figure out renames ?
             text = revlog.read(file_revision)
             entry.text_sha1 = sha_strings(text)
-            if manifest_flags[file]:
+            if manifest_flags.execf(file):
                 entry.executable = True
             entry.revision = modified_revision
         for dir, dir_revision_id in directories.items():
@@ -306,7 +314,7 @@
     def is_shared(self):
         """Whether this repository is being shared between multiple branches. 
         
-        Always false for Mercurial as it doesn't support checkouts yet.
+        Always False for Mercurial for now.
         """
         return False
 
@@ -314,18 +322,27 @@
 class HgBranchFormat(bzrlib.branch.BranchFormat):
     """Mercurial Branch Format.
 
-    This is currently not aware of different working tree formats,
+    This is currently not aware of different branch formats,
     but simply relies on the installed copy of mercurial to 
-    support the working tree format.
+    support the branch format.
     """
 
     def get_format_description(self):
         """See BranchFormat.get_format_description()."""
-        return "Mercurial Branch Format"
-
-    def get_format_string(self):
-        """See BranchFormat.get_branch_format()."""
-        return "Mercurial Branch Format"
+        return "Mercurial Branch"
+
+
+class HgBranchConfig(object):
+    """Access Branch Configuration data for an HgBranch.
+
+    This is not fully compatible with bzr yet - but it should be made so.
+    """
+
+    def __init__(self, branch):
+        self._branch = branch
+
+    def get_nickname(self):
+        return urlutils.unescape(self._branch.base.split('/')[-2])
 
 
 class HgBranch(bzrlib.branch.Branch):
@@ -345,15 +362,25 @@
 
     def get_parent(self):
         """Return the URL of the parent branch."""
+        # TODO: Obtain "repository default" 
         return None
 
     def get_physical_lock_status(self):
-        return False
+        return self.control_files.get_physical_lock_status()
 
     def get_push_location(self):
         """Return default push location of this branch."""
+        # TODO: Obtain "repository default"
         return None
 
+    def get_config(self):
+        """See Branch.get_config().
+
+        We return an HgBranchConfig, which is a stub class with little
+        functionality.
+        """
+        return HgBranchConfig(self)
+
     def lock_write(self):
         self.control_files.lock_write()
     
@@ -377,7 +404,7 @@
         self.control_files.lock_read()
 
     def tree_config(self):
-        return TreeConfig(self)
+        return MercurialBranchConfig(self)
   
     def unlock(self):
         self.control_files.unlock()
@@ -402,7 +429,7 @@
 
     def get_format_description(self):
         """See WorkingTreeFormat.get_format_description()."""
-        return "Mercurial Working Tree Format"
+        return "Mercurial Working Tree"
 
 
 class HgWorkingTree(bzrlib.workingtree.WorkingTree):
@@ -427,8 +454,7 @@
     @needs_write_lock
     def commit(self, message, *args, **kwargs):
         # TODO: selected file lists etc.
-        files, matchfn, anypats = mercurial.commands.matchpats(self._hgrepo)
-        self._hgrepo.commit([], message, None, None, matchfn, wlock=self._control_files._lock)
+        self._hgrepo.commit([], message, None, None, wlock=self._control_files._lock)
 
 #    def read_working_inventory(self):
 #        """in hg terms, read the manifest."""
@@ -533,14 +559,14 @@
         :param _create: create the hg dir on the fly. private to HgBzrDirFormat.
         """
         # we dont grok readonly - hg isn't integrated with transport.
-        url = transport.base
-        if url.startswith('readonly+'):
-            url = url[len('readonly+'):]
-        if url.startswith('file://'):
-            url = url[len('file://'):]
-        url = url.encode('utf8')
+        if transport.base.startswith('readonly+'):
+            transport = transport._decorated
+        if transport.base.startswith('file://'):
+            path = transport.local_abspath('.').encode('utf-8')
+        else:
+            raise errors.BzrCommandError('cannot use hg on %s transport' % transport)
         ui = mercurial.ui.ui()
-        repository = mercurial.hg.repository(ui, url, create=_create)
+        repository = mercurial.hg.repository(ui, path, create=_create)
         lockfiles = HgLockableFiles(HgLock(repository))
         return HgDir(repository, transport, lockfiles, self)
 
@@ -571,7 +597,7 @@
     """A class to upgrade an hg dir to something else."""
 
 
-class InterHgRepository(bzrlib.repository.InterRepository):
+class FromHgRepository(bzrlib.repository.InterRepository):
     """Hg to any repository actions."""
 
     _matching_repo_format = None 
@@ -598,7 +624,9 @@
         # rev-at-a-time.
         needed = {}
         if revision_id is None:
-            raise NotImplementedError("fetching of everything not yet implemented.")
+            pending = set()
+            for revision_id in self.source._hgrepo.changelog.heads():
+                pending.add(bzrrevid_from_hg(revision_id))
         else:
             # add what can be reached from revision_id
             pending = set([revision_id])
@@ -693,121 +721,17 @@
         """Be compatible with HgRepositories."""
         return isinstance(source, HgRepository)
 
-bzrlib.repository.InterRepository.register_optimiser(InterHgRepository)
+bzrlib.repository.InterRepository.register_optimiser(FromHgRepository)
 
 def test_suite():
-    return TestLoader().loadTestsFromName(__name__)
-
-
-class TestPulling(TestCaseWithTransport):
-    """Tests for pulling from hg to bzr."""
-
-    def setUp(self):
-        super(TestPulling, self).setUp()
-        self.build_tree(['hg/', 'hg/a', 'hg/b', 'hg/dir/', 'hg/dir/c'])
-        hgdir = HgBzrDirFormat().initialize('hg')
-        self.tree = hgdir.open_workingtree()
-        mode = os.lstat('hg/b').st_mode
-        os.chmod('hg/b', mode | stat.S_IEXEC)
-        # do not add 'dir' to ensure that we pickup dir/c anyway : if hg
-        # changes it behaviour, we want this test to start failing.
-        self.tree.add(['a', 'b', 'dir/c'])
-        self.tree.commit('foo')
-        revone_inventory = Inventory()
-        tip = self.tree.last_revision()
-        entry = revone_inventory.add_path('a', kind='file', file_id='hg:a')
-        entry.revision = tip
-        entry.text_size = len('contents of hg/a\n')
-        entry.text_sha1 = "72bcea9d6cba6ee7d3241bfa0c5e54506ad81a94"
-        entry = revone_inventory.add_path('b', kind='file', file_id='hg:b')
-        entry.executable = True
-        entry.revision = tip
-        entry.text_size = len('contents of hg/b\n')
-        entry.text_sha1 = "b4d0c22d126cd0afeeeffa62961fb47c0932835a"
-        entry = revone_inventory.add_path('dir', kind='directory',
-            file_id='hg:dir')
-        entry.revision = tip
-        entry = revone_inventory.add_path('dir/c', kind='file',
-            file_id='hg:dir:c')
-        entry.revision = tip
-        entry.text_size = len('contents of hg/dir/c\n')
-        entry.text_sha1 = "958be752affac0fee70471331b96fb3fc1809425"
-        self.revone_inventory = revone_inventory
-        self.revidone = tip
-        #====== end revision one
-        self.build_tree(['hg/dir/d'])
-        self.tree.add(['dir/d'])
-        self.tree.commit('bar')
-        self.revtwo_inventory = copy.deepcopy(revone_inventory)
-        tip = self.tree.last_revision()
-        entry = self.revtwo_inventory.add_path('dir/d', kind='file',
-            file_id='hg:dir:d')
-        entry.revision = tip
-        entry.text_size = len('contents of hg/dir/d\n')
-        entry.text_sha1 = "f48fc342f707bfb4711790e1813c0df4d44e1a23"
-        self.revidtwo = tip
-        #====== end revision two
-        # in revision three, we reset the exec flag on 'b'
-        os.chmod('hg/b', mode)
-        self.tree.commit('reset mode on b')
-        self.revthree_inventory = copy.deepcopy(self.revtwo_inventory)
-        tip = self.tree.last_revision()
-        # should be a new file revision with exec reset
-        entry = self.revthree_inventory['hg:b']
-        entry.revision = tip
-        entry.executable = False
-        self.revidthree = tip
-
-    def test_inventory_from_manifest(self):
-        repo = self.tree.branch.repository
-        left = self.revone_inventory
-        right = repo.get_inventory(self.revidone)
-        self.assertEqual(left._byid, right._byid)
-        left = self.revtwo_inventory
-        right = repo.get_inventory(self.revidtwo)
-        self.assertEqual(left._byid, right._byid)
-        left = self.revthree_inventory
-        right = repo.get_inventory(self.revidthree)
-        self.assertEqual(left._byid, right._byid)
-
-    def test_initial_revision_from_changelog(self):
-        converted_rev = self.tree.branch.repository.get_revision(self.revidone)
-        self.assertEqual([], converted_rev.parent_ids)
-        self.assertEqual({}, converted_rev.properties)
-        self.assertEqual('foo', converted_rev.message)
-        self.assertEqual(self.revidone, converted_rev.revision_id)
-        # we dont have a serialised inventory to convert, and the inv sha1 is
-        # of reducing meaning now.
-        self.assertEqual("", converted_rev.inventory_sha1)
-        self.assertNotEqual(None, converted_rev.timestamp)
-        self.assertNotEqual(None, converted_rev.timezone)
-        self.assertNotEqual(None, converted_rev.committer)
-
-    def test_non_initial_revision_from_changelog(self):
-        converted_rev = self.tree.branch.repository.get_revision(self.revidtwo)
-        self.assertEqual([self.revidone], converted_rev.parent_ids)
-        self.assertEqual({}, converted_rev.properties)
-        self.assertEqual('bar', converted_rev.message)
-        self.assertEqual(self.revidtwo, converted_rev.revision_id)
-        # we dont have a serialised inventory to convert, and the inv sha1 is
-        # of reducing meaning now.
-        self.assertEqual("", converted_rev.inventory_sha1)
-        self.assertNotEqual(None, converted_rev.timestamp)
-        self.assertNotEqual(None, converted_rev.timezone)
-        self.assertNotEqual(None, converted_rev.committer)
-
-    def test_has_revision(self):
-        self.assertTrue(self.tree.branch.repository.has_revision(self.revidone))
-        self.assertTrue(self.tree.branch.repository.has_revision(self.revidtwo))
-        self.assertFalse(self.tree.branch.repository.has_revision('foo'))
-
-    def test_pull_into_bzr(self):
-        bzrtree = self.make_branch_and_tree('bzr')
-        bzrtree.pull(self.tree.branch)
-        self.assertFileEqual('contents of hg/a\n', 'bzr/a')
-        self.assertFileEqual('contents of hg/b\n', 'bzr/b')
-        self.assertFileEqual('contents of hg/dir/c\n', 'bzr/dir/c')
-        
+    from unittest import TestSuite, TestLoader
+    import tests
+
+    suite = TestSuite()
+
+    suite.addTest(tests.test_suite())
+
+    return suite      
 
 # TODO: test that a last-modified in a merged branch is correctly assigned
 # TODO: test that we set the per file parents right: that is the rev of the

=== modified file 'setup.py'
--- a/setup.py	2006-07-06 01:02:16 +0000
+++ b/setup.py	2007-01-20 18:35:59 +0000
@@ -3,7 +3,7 @@
 from distutils.core import setup
 
 setup(name='bzr-hg',
-      description='Support for Mercurial branches in Bazaar-NG',
+      description='Support for Mercurial branches in Bazaar',
       keywords='plugin bzr hg mercurial bazaar',
       version='0.1',
       url='http://bazaar-vcs.org/BzrForeignBranches/Mercurial',
@@ -11,8 +11,8 @@
       author='Robert Collins',
       author_email='robertc at robertcollins.net',
       long_description="""
-      This plugin adds support for branching off Mercurial branches in 
-      Bazaar.
+      This plugin adds limited support for checking out and viewing 
+      Mercurial branches in Bazaar.
       """,
       package_dir={'bzrlib.plugins.hg':'.'},
       packages=['bzrlib.plugins.hg']




More information about the bazaar-commits mailing list