Rev 1167: Fix setting of branching scheme. in file:///data/jelmer/bzr-svn/0.4/

Jelmer Vernooij jelmer at samba.org
Thu May 15 02:23:35 BST 2008


At file:///data/jelmer/bzr-svn/0.4/

------------------------------------------------------------
revno: 1167
revision-id: jelmer at samba.org-20080515012334-zu30n7oblltur8ke
parent: jelmer at samba.org-20080514193048-0lh7mc9c9x6494o1
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Thu 2008-05-15 03:23:34 +0200
message:
  Fix setting of branching scheme.
modified:
  NEWS                           news-20061231030336-h9fhq245ie0de8bs-1
  __init__.py                    __init__.py-20051008155114-eae558e6cf149e1d
  tests/test_blackbox.py         test_blackbox.py-20070325150839-d10llf8arptpcfl6-1
=== modified file 'NEWS'
--- a/NEWS	2008-05-14 19:30:48 +0000
+++ b/NEWS	2008-05-15 01:23:34 +0000
@@ -11,6 +11,8 @@
 
    * Fix use of unicode characters in filenames when committing. (#230090)
 
+   * Fix modifying branching scheme from the command-line. (#230529)
+
 bzr-svn 0.4.10  2008-05-12
 
   CHANGES

=== modified file '__init__.py'
--- a/__init__.py	2008-05-11 23:34:03 +0000
+++ b/__init__.py	2008-05-15 01:23:34 +0000
@@ -375,6 +375,7 @@
         from bzrlib.trace import info
         from repository import SvnRepository
         from mapping3.scheme import scheme_from_branch_list
+        from mapping3 import config_set_scheme, get_property_scheme, set_property_scheme
         def scheme_str(scheme):
             if scheme is None:
                 return ""
@@ -384,7 +385,7 @@
         if not isinstance(repos, SvnRepository):
             raise BzrCommandError("Not a Subversion repository: %s" % location)
         if repository_wide:
-            scheme = repos._get_property_scheme()
+            scheme = get_property_scheme(repos)
         else:
             scheme = repos.get_mapping().scheme
         if set:
@@ -395,7 +396,7 @@
             if repository_wide:
                 set_property_scheme(repos, scheme)
             else:
-                set_config_scheme(repos, scheme, mandatory=True)
+                config_set_scheme(repos, scheme, mandatory=True)
         elif scheme is not None:
             info(scheme_str(scheme))
 

=== modified file 'tests/test_blackbox.py'
--- a/tests/test_blackbox.py	2008-05-02 18:37:05 +0000
+++ b/tests/test_blackbox.py	2008-05-15 01:23:34 +0000
@@ -23,7 +23,7 @@
 from mapping3.scheme import NoBranchingScheme
 from tests import TestCaseWithSubversionRepository
 
-import os
+import os, sys
 
 class TestBranch(ExternalBase, TestCaseWithSubversionRepository):
     def test_branch_empty(self):
@@ -219,3 +219,49 @@
         self.client_commit("dc", "Msg")
         self.run_bzr("checkout --lightweight dc de")
 
+    # this method imported from bzrlib.tests.test_msgeditor:
+    def make_fake_editor(self, message='test message from fed\\n'):
+        """Set up environment so that an editor will be a known script.
+
+        Sets up BZR_EDITOR so that if an editor is spawned it will run a
+        script that just adds a known message to the start of the file.
+        """
+        f = file('fed.py', 'wb')
+        f.write('#!%s\n' % sys.executable)
+        f.write("""\
+# coding=utf-8
+import sys
+if len(sys.argv) == 2:
+    fn = sys.argv[1]
+    f = file(fn, 'rb')
+    s = f.read()
+    f.close()
+    f = file(fn, 'wb')
+    f.write('%s')
+    f.write(s)
+    f.close()
+""" % (message, ))
+        f.close()
+        if sys.platform == "win32":
+            # [win32] make batch file and set BZR_EDITOR
+            f = file('fed.bat', 'w')
+            f.write("""\
+ at echo off
+"%s" fed.py %%1
+""" % sys.executable)
+            f.close()
+            os.environ['BZR_EDITOR'] = 'fed.bat'
+        else:
+            # [non-win32] make python script executable and set BZR_EDITOR
+            os.chmod('fed.py', 0755)
+            os.environ['BZR_EDITOR'] = './fed.py'
+
+    def test_set_branching_scheme_local(self):
+        self.make_fake_editor()
+        repos_url = self.make_client("a", "dc")
+        self.check_output("", 'svn-branching-scheme --set %s' % repos_url)
+
+    def test_set_branching_scheme_global(self):
+        self.make_fake_editor()
+        repos_url = self.make_client("a", "dc")
+        self.check_output("", 'svn-branching-scheme --repository-wide --set %s' % repos_url)




More information about the bazaar-commits mailing list