~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/status.py

  • Committer: Parth Malwankar
  • Date: 2010-08-28 06:13:48 UTC
  • mto: This revision was merged to the branch mainline in revision 5411.
  • Revision ID: parth.malwankar@gmail.com-20100828061348-w9butw4ackj8wpyl
initial post_status hook is now working

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
from bzrlib import (
20
20
    delta as _mod_delta,
 
21
    hooks as _mod_hooks,
21
22
    log,
22
23
    osutils,
23
24
    tsort,
210
211
                show_pending_merges(new, to_file, short, verbose=verbose)
211
212
            if nonexistents:
212
213
                raise errors.PathsDoNotExist(nonexistents)
 
214
            for hook in hooks['post_status']:
 
215
                hook(old, new, versioned, show_ids, short)
213
216
        finally:
214
217
            old.unlock()
215
218
            new.unlock()
356
359
    # their groups individually.  But for consistency of this
357
360
    # function's API, it's better to sort both than just 'nonexistent'.
358
361
    return sorted(remaining), sorted(nonexistent)
 
362
 
 
363
 
 
364
class StatusHooks(_mod_hooks.Hooks):
 
365
    """A dictionary mapping hook name to a list of callables for status hooks.
 
366
 
 
367
    e.g. ['post_status'] Is the list of items to be called when the
 
368
    status command has finished printing the status.
 
369
    """
 
370
 
 
371
    def __init__(self):
 
372
        """Create the default hooks.
 
373
 
 
374
        These are all empty initially, because by default nothing should get
 
375
        notified.
 
376
        """
 
377
        _mod_hooks.Hooks.__init__(self)
 
378
        self.create_hook(_mod_hooks.HookPoint('post_status',
 
379
            "Called after bazaar has printed the status with arguments "
 
380
            "(old_tree, new_tree, versioned, show_ids, short). The last "
 
381
            "three arguments correspont to the command line options "
 
382
            "specified by the user for the status command.",
 
383
            (2, 3), None))
 
384
 
 
385
 
 
386
hooks = StatusHooks()
 
387