[MERGE][0.8.1] Msgeditor and backport of info

Olaf Conradi olaf at conradi.org
Sat May 13 12:06:39 BST 2006


Hello,

The previously approved patches for info and msgeditor now made against
bzr.0.8 branch.

This is the same patch as in:
https://lists.ubuntu.com/archives/bazaar-ng/2006q2/011434.html
https://lists.ubuntu.com/archives/bazaar-ng/2006q2/011870.html

For your convenience they exist in my bzr 0.8 integration branch, but
also in separate branches:

http://deschacht.student.utwente.nl/bzr/bazaar-vcs/bzr.0.8.olaf.integration/

or

http://deschacht.student.utwente.nl/bzr/bazaar-vcs/bzr.0.8.olaf.msgeditor/
http://deschacht.student.utwente.nl/bzr/bazaar-vcs/bzr.0.8.olaf.info/


I also have bug fixes for uses of get_ancestry() which do not, or
incorrectly, remove the None entry from the list. That patch needs
review first. But after that I can merge that into this integration
branch as well. Your call (core devs) to merge it all separate or as
one.

Cheers
 -Olaf

-------------- next part --------------
=== modified file 'NEWS'
--- NEWS	
+++ NEWS	
@@ -7,12 +7,20 @@
 
     * Nicer messages from 'commit' in the case of renames, and correct
       messages when a merge has occured. (Robert Collins, Martin Pool)
+
+    * Add info on standalone branches without a working tree.
+      (#44155, Olaf Conradi)
 
   INTERNALS:
 
     * New public api in InventoryEntry - 'describe_change(old, new)' which
       provides a human description of the changes between two old and
       new. (Robert Collins, Martin Pool)
+
+  TESTING:
+
+    * Fix test case for bzr info in upgrading a standalone branch to metadir,
+      uses bzrlib api now. (Olaf Conradi)
 
 bzr 0.8  2006-05-08
 

=== modified file 'bzrlib/info.py'
--- bzrlib/info.py	
+++ bzrlib/info.py	
@@ -85,12 +85,15 @@
             # standalone
             print '  branch root: %s' % working_path
     elif branch:
-        # branch is part of shared repository
-        assert repository.is_shared()
         branch_path = branch.bzrdir.root_transport.base
-        print '  shared repository: %s' % repository_path
-        print '  repository branch: %s' % (
-            _repo_relpath(repository_path, branch_path))
+        if repository.is_shared():
+            # branch is part of shared repository
+            print '  shared repository: %s' % repository_path
+            print '  repository branch: %s' % (
+                _repo_relpath(repository_path, branch_path))
+        else:
+            # standalone branch
+            print '  branch root: %s' % branch_path
     else:
         # shared repository
         assert repository.is_shared()

=== modified file 'bzrlib/tests/blackbox/test_info.py'
--- bzrlib/tests/blackbox/test_info.py	
+++ bzrlib/tests/blackbox/test_info.py	
@@ -129,11 +129,8 @@
 
         # Branch and bind to standalone, needs upgrade to metadir
         # (creates backup as unknown)
-        # XXX: I can't get this to work through API
-        self.runbzr('branch standalone bound')
-        #branch3 = branch1.bzrdir.sprout('bound').open_branch()
-        self.runbzr('upgrade --format=metaweave bound')
-        #bzrlib.upgrade.upgrade('bound', bzrlib.bzrdir.BzrDirMetaFormat1())
+        branch1.bzrdir.sprout('bound')
+        bzrlib.upgrade.upgrade('bound', bzrlib.bzrdir.BzrDirMetaFormat1())
         branch3 = bzrlib.bzrdir.BzrDir.open('bound').open_branch()
         branch3.bind(branch1)
         out, err = self.runbzr('info bound')
@@ -460,6 +457,31 @@
 """ % (tree5.bzrdir.root_transport.base,
        branch1.bzrdir.root_transport.base,
        datestring_first, datestring_last,
+       ), out)
+        self.assertEqual('', err)
+
+    def test_info_standalone_no_tree(self):
+        # create standalone branch without a working tree
+        branch = self.make_branch('branch')
+        repo = branch.repository
+        out, err = self.runbzr('info branch')
+        self.assertEqualDiff(
+"""Location:
+  branch root: %s
+
+Format:
+       control: Meta directory format 1
+        branch: Branch format 5
+    repository: %s
+
+Branch history:
+         0 revisions
+
+Revision store:
+         0 revisions
+         0 KiB
+""" % (branch.bzrdir.root_transport.base,
+       repo._format.get_format_description(),
        ), out)
         self.assertEqual('', err)
 

-------------- next part --------------
=== modified file 'NEWS'
--- NEWS	
+++ NEWS	
@@ -10,6 +10,13 @@
 
     * Add info on standalone branches without a working tree.
       (#44155, Olaf Conradi)
+
+  CHANGES:
+
+    * Make editor invocation comply with Debian Policy. First check
+      environment variables VISUAL and EDITOR, then try editor from
+      alternatives system. If that all fails, fall back to the pre-defined
+      list of editors. (#42904, Olaf Conradi)
 
   INTERNALS:
 

=== modified file 'bzrlib/msgeditor.py'
--- bzrlib/msgeditor.py	
+++ bzrlib/msgeditor.py	
@@ -39,6 +39,11 @@
         yield e
         
     try:
+        yield os.environ["VISUAL"]
+    except KeyError:
+        pass
+        
+    try:
         yield os.environ["EDITOR"]
     except KeyError:
         pass
@@ -47,7 +52,7 @@
         for editor in 'wordpad.exe', 'notepad.exe':
             yield editor
     else:
-        for editor in ['vi', 'pico', 'nano', 'joe']:
+        for editor in ['/usr/bin/editor', 'vi', 'pico', 'nano', 'joe']:
             yield editor
 
 

=== modified file 'bzrlib/tests/test_msgeditor.py'
--- bzrlib/tests/test_msgeditor.py	
+++ bzrlib/tests/test_msgeditor.py	
@@ -53,9 +53,11 @@
     def test__get_editor(self):
         # Test that _get_editor can return a decent list of items
         bzr_editor = os.environ.get('BZR_EDITOR')
+        visual = os.environ.get('VISUAL')
         editor = os.environ.get('EDITOR')
         try:
             os.environ['BZR_EDITOR'] = 'bzr_editor'
+            os.environ['VISUAL'] = 'visual'
             os.environ['EDITOR'] = 'editor'
 
             ensure_config_dir_exists()
@@ -65,13 +67,14 @@
 
             editors = list(_get_editor())
 
-            self.assertEqual(['bzr_editor', 'config_editor', 'editor'],
-                editors[:3])
+            self.assertEqual(['bzr_editor', 'config_editor', 'visual',
+                              'editor'], editors[:4])
 
             if sys.platform == 'win32':
-                self.assertEqual(['wordpad.exe', 'notepad.exe'], editors[3:])
+                self.assertEqual(['wordpad.exe', 'notepad.exe'], editors[4:])
             else:
-                self.assertEqual(['vi', 'pico', 'nano', 'joe'], editors[3:])
+                self.assertEqual(['/usr/bin/editor', 'vi', 'pico', 'nano',
+                                  'joe'], editors[4:])
 
         finally:
             # Restore the environment
@@ -79,8 +82,11 @@
                 del os.environ['BZR_EDITOR']
             else:
                 os.environ['BZR_EDITOR'] = bzr_editor
+            if visual is None:
+                del os.environ['VISUAL']
+            else:
+                os.environ['VISUAL'] = visual
             if editor is None:
                 del os.environ['EDITOR']
             else:
                 os.environ['EDITOR'] = editor
-



More information about the bazaar mailing list