source: tailor/vcpx/dualwd.py @ 607

Revision 607, 2.3 KB checked in by lele@…, 8 years ago (diff)

Renamed initializeNewWorkingDir() to importFirstRevision()

Line 
1# -*- mode: python; coding: utf-8 -*-
2# :Progetto: vcpx -- Dual working directory
3# :Creato:   dom 20 giu 2004 11:02:01 CEST
4# :Autore:   Lele Gaifax <lele@nautilus.homeip.net>
5# :Licenza:  GNU General Public License
6#
7
8"""
9The easiest way to propagate changes from one VC control system to one
10of an another kind is having a single directory containing a live
11working copy shared between the two VC systems.
12
13This module implements `DualWorkingDir`, which instances have a
14`source` and `target` properties offering the right capabilities to do
15the job.
16"""
17
18__docformat__ = 'reStructuredText'
19
20from source import UpdatableSourceWorkingDir, InvocationError
21from target import SyncronizableTargetWorkingDir
22
23IGNORED_METADIRS = []
24
25class DualWorkingDir(UpdatableSourceWorkingDir, SyncronizableTargetWorkingDir):
26    """
27    Dual working directory, one that is under two different VC systems at
28    the same time.
29
30    This class reimplements the two interfaces, dispatching the right method
31    to the right backend.
32    """
33
34    def __init__(self, source_repo, target_repo):
35        global IGNORED_METADIRS
36
37        self.source = source_repo.workingDir()
38        self.target = target_repo.workingDir()
39
40        IGNORED_METADIRS = [source_repo.METADIR, target_repo.METADIR]
41
42        # UpdatableSourceWorkingDir
43
44        self.getPendingChangesets = self.source.getPendingChangesets
45        self.checkoutUpstreamRevision = self.source.checkoutUpstreamRevision
46
47        # SyncronizableTargetWorkingDir
48
49        self.prepareWorkingDirectory = self.target.prepareWorkingDirectory
50        self.importFirstRevision = self.target.importFirstRevision
51        self.replayChangeset = self.target.replayChangeset
52
53    def setStateFile(self, state_file):
54        """
55        Set the state file used to store the revision and pending changesets.
56        """
57
58        self.source.setStateFile(state_file)
59        self.target.setStateFile(state_file)
60
61    def setLogfile(self, logfile):
62        """
63        Set the name of the logfile, just to ignore it.
64        """
65
66        self.target.logfile = logfile
67
68    def applyPendingChangesets(self, applyable=None, replay=None, applied=None):
69        return self.source.applyPendingChangesets(replay=self.replayChangeset,
70                                                  applyable=applyable,
71                                                  applied=applied)
Note: See TracBrowser for help on using the repository browser.