/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/bzrdir.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-04-22 17:08:27 UTC
  • mfrom: (5107.3.8 new_branch_and_repo_hooks)
  • Revision ID: pqm@pqm.ubuntu.com-20100422170827-h0bb41yq5nkosu6t
(vila) Add 'post_repo_init', 'post_branch_init' and 'post_switch' hooks. (Marco Pantaleoni)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1330
1330
        self.create_hook(hooks.HookPoint('pre_open',
1331
1331
            "Invoked before attempting to open a BzrDir with the transport "
1332
1332
            "that the open will use.", (1, 14), None))
 
1333
        self.create_hook(hooks.HookPoint('post_repo_init',
 
1334
            "Invoked after a repository has been initialized. "
 
1335
            "post_repo_init is called with a "
 
1336
            "bzrlib.bzrdir.RepoInitHookParams.",
 
1337
            (2, 2), None))
1333
1338
 
1334
1339
# install the default hooks
1335
1340
BzrDir.hooks = BzrDirHooks()
1336
1341
 
1337
1342
 
 
1343
class RepoInitHookParams(object):
 
1344
    """Object holding parameters passed to *_repo_init hooks.
 
1345
 
 
1346
    There are 4 fields that hooks may wish to access:
 
1347
 
 
1348
    :ivar repository: Repository created
 
1349
    :ivar format: Repository format
 
1350
    :ivar bzrdir: The bzrdir for the repository
 
1351
    :ivar shared: The repository is shared
 
1352
    """
 
1353
 
 
1354
    def __init__(self, repository, format, a_bzrdir, shared):
 
1355
        """Create a group of RepoInitHook parameters.
 
1356
 
 
1357
        :param repository: Repository created
 
1358
        :param format: Repository format
 
1359
        :param bzrdir: The bzrdir for the repository
 
1360
        :param shared: The repository is shared
 
1361
        """
 
1362
        self.repository = repository
 
1363
        self.format = format
 
1364
        self.bzrdir = a_bzrdir
 
1365
        self.shared = shared
 
1366
 
 
1367
    def __eq__(self, other):
 
1368
        return self.__dict__ == other.__dict__
 
1369
 
 
1370
    def __repr__(self):
 
1371
        if self.repository:
 
1372
            return "<%s for %s>" % (self.__class__.__name__,
 
1373
                self.repository)
 
1374
        else:
 
1375
            return "<%s for %s>" % (self.__class__.__name__,
 
1376
                self.bzrdir)
 
1377
 
 
1378
 
1338
1379
class BzrDirPreSplitOut(BzrDir):
1339
1380
    """A common class for the all-in-one formats."""
1340
1381