Rev 60: Remove wrapping pull/push/merge/branch commands. in file:///home/jelmer/bzr-submit/nowrap/

Jelmer Vernooij jelmer at samba.org
Sat Apr 7 23:28:24 BST 2007


At file:///home/jelmer/bzr-submit/nowrap/

------------------------------------------------------------
revno: 60
revision-id: jelmer at samba.org-20070407222819-v7bt7jt65djqqgzm
parent: jelmer at samba.org-20070407024347-mbwdcaml32dyv3kg
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: nowrap
timestamp: Sun 2007-04-08 00:28:19 +0200
message:
  Remove wrapping pull/push/merge/branch commands.
modified:
  __init__.py                    __init__.py-20060624164558-9aabyghnw7kxeuwg-1
  submit_helpers.py              submit_helpers.py-20060624164558-9aabyghnw7kxeuwg-2
=== modified file '__init__.py'
--- a/__init__.py	2007-04-07 02:43:47 +0000
+++ b/__init__.py	2007-04-07 22:28:19 +0000
@@ -7,8 +7,6 @@
 from bzrlib.commands import Command, register_command
 from bzrlib.option import Option
 
-show_extension_text = False
-
 
 class cmd_submit_bundle(Command):
     """Submit a signed bundle to a mailinglist or PQM.
@@ -86,174 +84,6 @@
 
 submit_options = ['submit-address', 'submit-maintainer', 'submit-mailinglist']
 
-def read_options(branch):
-    _copy_options(branch, branch, False)
-
-def _copy_options(branch_from, branch_to, overwrite = False):
-    """Copy options from one branch to another"""
-    
-    import re
-    
-    from bzrlib import config
-    
-    from submit_helpers import store_config_in_branch
-    
-    config_from = config.BranchConfig(branch_from)
-    config_to   = config.BranchConfig(branch_to)
-    
-    conflict_list = []
-    
-    # First check if there is an versioned file '.submit-options'
-    try:
-        revision_id = branch_from.last_revision()
-        rep = branch_from.repository
-        tree = rep.revision_tree(revision_id)
-        file_id = tree.inventory.path2id('.submit-options')
-        if file_id:
-            option_re = re.compile(r'^([^#]\S+)\s*=\s*(\S+)$')
-            file_text = tree.get_file_text(file_id).split('\n')
-            for line in file_text:
-                result = option_re.match(line)
-                if result is None:
-                    # Skip all lines that don't have the format
-                    # name = value
-                    # or that start with #
-                    continue 
-            
-                option, option_from = result.groups()
-                option_to = config_to.get_user_option(option)
-                if option_to is None:
-                    store_config_in_branch(config_to, option, option_from)
-                elif option_to != option_from:
-                    conflict_list.append((option, option_from, option_to))
-                    if overwrite:
-                        store_config_in_branch(config_to, option, option_from)
-    except Exception, e:
-        print "Could not read file '.submit-options':", str(e) 
-        # No matter which error occurs here the command should not fail
-
-    for option in submit_options:
-        option_from = config_from.get_user_option(option)
-        option_to   = config_to.get_user_option(option)
-        if option_from is None:
-            continue
-        
-        if option_to is None:
-            store_config_in_branch(config_to, option, option_from)
-        elif option_to != option_from:
-            conflict_list.append((option, option_from, option_to))
-            if overwrite:
-                store_config_in_branch(config_to, option, option_from)
-                
-    if len(conflict_list)>0:
-        if overwrite:
-            trace.warning("There were conflicts in the submit "+
-                "options. Old values were overwriten.")
-        else:
-            trace.warning("There were conflicts in the submit "+
-                "options. Old values were kept.")
-        format_str = "%25s|%35s|%35s"
-        trace.warning(format_str % ("Name", "Old value", "New value"))
-        for conflict in conflict_list:
-            trace.warning(format_str % conflict)
-
-            
-class cmd_pull(builtins.cmd_pull):
-
-    __doc__ = builtins.cmd_pull.__doc__
-        
-    def run(self, location=None, overwrite=False, **parameters):
-        from bzrlib.branch import Branch
-        from bzrlib.errors import NotBranchError
-        
-
-        if (show_extension_text):
-            trace.info("Pull with submit extensions.")
-        result = pull_class.run(self, location=location, **parameters)
-        try:
-            branch_to   = Branch.open_containing(u'.')[0]
-            if location is None:
-                location = branch_to.get_parent()
-            branch_from = Branch.open(location)
-            _copy_options(branch_from, branch_to, overwrite)
-        except NotBranchError:
-            pass # Perhaps a bundle
-        except Exception, e:
-            print("Could not copy submit targets: " + str(e))
-        return result
-
-        
-class cmd_push(builtins.cmd_push):
-
-    __doc__ = builtins.cmd_push.__doc__
-        
-    def run(self, location=None, overwrite=False, **parameters):
-        from bzrlib.branch import Branch
-        
-        if (show_extension_text):
-            trace.info("Push with submit extensions.")
-        result = push_class.run(self, location=location, **parameters)
-        try:
-            branch_from   = Branch.open_containing(u'.')[0]
-            if location is None:
-                location = branch_from.get_parent()
-            branch_to = Branch.open(location)
-            _copy_options(branch_from, branch_to, overwrite)
-        except Exception, e:
-            print("Could not copy submit targets: " + str(e))
-        return result
-        
-            
-class cmd_merge(builtins.cmd_merge):
-
-    __doc__ = builtins.cmd_merge.__doc__
-    
-    def run(self, branch=None, **parameters):
-        from bzrlib.branch import Branch
-        from bzrlib.errors import NotBranchError
-        
-        if (show_extension_text):
-            trace.info("Merge with submit extensions.")
-        result = merge_class.run(self, branch, **parameters)
-        try:
-            # branch_to is the current branch
-            # branch_from is the branch we are merging from
-            # if no brach_from (parametername: branch) is given
-            # the remembered branch is chosen
-            branch_to   = Branch.open_containing(u'.')[0]
-            if branch is None:
-                branch = branch_to.get_parent()
-            branch_from = Branch.open(branch)
-            _copy_options(branch_from, branch_to, overwrite = False)
-        except NotBranchError:
-            pass # Perhaps a bundle
-        except Exception, e:
-            print("Could not copy submit targets: " + str(e))
-        return result 
-        
-class cmd_branch(builtins.cmd_branch):
-
-    __doc__ = builtins.cmd_branch.__doc__
-    
-    def run(self, from_location, to_location=None, **parameters):
-        
-        from bzrlib.branch import Branch
-        
-        if (show_extension_text):
-            trace.info("Branch with submit extensions.")
-        result = branch_class.run(self, from_location, 
-            to_location, **parameters)
-        try:
-            if to_location is None:
-                to_location = os.path.basename(from_location.rstrip("/\\"))
-            branch_to   = Branch.open(to_location)
-            branch_from = Branch.open(from_location)
-            _copy_options(branch_from, branch_to, overwrite = False)
-        except Exception, e:
-            print("Could not copy submit targets: " + str(e))
-        return result 
-
-
 class cmd_info(builtins.cmd_info):
 
     __doc__ = builtins.cmd_info.__doc__
@@ -284,10 +114,6 @@
 
 register_command(cmd_submit_bundle)
 register_command(cmd_apply_bundle)
-pull_class   = register_command(cmd_pull, True)
-push_class   = register_command(cmd_push, True)
-merge_class  = register_command(cmd_merge, True)
-branch_class = register_command(cmd_branch, True)
 info_class   = register_command(cmd_info, True)
 
 

=== modified file 'submit_helpers.py'
--- a/submit_helpers.py	2007-03-23 20:11:14 +0000
+++ b/submit_helpers.py	2007-04-07 22:28:19 +0000
@@ -332,7 +332,6 @@
             warning("WARNING: Could not sign the message. " + \
                 "This means your identity can't be verified by the " + \
                 "recipient. Error message: " + str(e))
-    
    
     msg = create_mime_message(get_subject(branch, subject), mail_from,
         mail_to, message_text, bundle_text, multipart)




More information about the bazaar-commits mailing list