~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Ian Clatworthy
  • Date: 2008-03-14 19:44:24 UTC
  • mfrom: (3254.2.11 hook-type-descriptions)
  • mto: This revision was merged to the branch mainline in revision 3277.
  • Revision ID: ian.clatworthy@canonical.com-20080314194424-p4u1imde9iib89rm
(Daniel Mark Watkins) Add the hooks command

Show diffs side-by-side

added added

removed removed

Lines of Context:
4452
4452
            urlutils.unescape_for_display(to_branch.base, 'utf-8'))
4453
4453
 
4454
4454
 
 
4455
class cmd_hooks(Command):
 
4456
    """Show a branch's currently registered hooks.
 
4457
    """
 
4458
 
 
4459
    hidden = True
 
4460
    takes_args = ['path?']
 
4461
 
 
4462
    def run(self, path=None):
 
4463
        if path is None:
 
4464
            path = '.'
 
4465
        branch_hooks = Branch.open(path).hooks
 
4466
        for hook_type in branch_hooks:
 
4467
            hooks = branch_hooks[hook_type]
 
4468
            self.outf.write("%s:\n" % (hook_type,))
 
4469
            if hooks:
 
4470
                for hook in hooks:
 
4471
                    self.outf.write("  %s\n" %
 
4472
                                    (branch_hooks.get_hook_name(hook),))
 
4473
            else:
 
4474
                self.outf.write("  <no hooks installed>\n")
 
4475
 
 
4476
 
4455
4477
def _create_prefix(cur_transport):
4456
4478
    needed = [cur_transport]
4457
4479
    # Recurse upwards until we can create a directory successfully