Changeset 1179 in tailor for vcpx/repository/hg.py


Ignore:
Timestamp:
06/25/06 01:12:08 (7 years ago)
Author:
lele@…
Hash name:
20060624231208-97f81-7b9ce234ef7b5441fe2a59ef89689e76b9466411
Message:

Split the monolithic repository.py into smaller units
The repository subclass of each backend is now in the same unit that
implements its working dir, under the vcpx.repository subpackage.
This has several advantages: the obvious of keeping related code closer
and the ability of lazy load only the needed unit, as it was already done
for the working dir subclasses.

Location:
vcpx/repository
Files:
1 added
1 moved

Legend:

Unmodified
Added
Removed
  • vcpx/repository/hg.py

    r1172 r1179  
    1414__docformat__ = 'reStructuredText' 
    1515 
    16 from source import UpdatableSourceWorkingDir 
    17 from target import SynchronizableTargetWorkingDir 
    1816from mercurial import ui, hg, commands 
     17 
     18from vcpx.repository import Repository 
     19from vcpx.source import UpdatableSourceWorkingDir 
     20from vcpx.target import SynchronizableTargetWorkingDir 
     21 
     22 
     23class HgRepository(Repository): 
     24    METADIR = '.hg' 
     25 
     26    def _load(self, project): 
     27        Repository._load(self, project) 
     28        ppath = project.config.get(self.name, 'python-path') 
     29        if ppath: 
     30            from sys import path 
     31 
     32            if ppath not in path: 
     33                path.insert(0, ppath) 
     34        self.EXTRA_METADIRS = ['.hgtags'] 
     35 
     36    def _validateConfiguration(self): 
     37        """ 
     38        Mercurial expects all data to be in utf-8, so we disallow other encodings 
     39        """ 
     40        Repository._validateConfiguration(self) 
     41 
     42        if self.encoding.upper() != 'UTF-8': 
     43            self.log.warning("Forcing UTF-8 encoding instead of " + self.encoding) 
     44            self.encoding = 'UTF-8' 
     45 
    1946 
    2047class HgWorkingDir(UpdatableSourceWorkingDir, SynchronizableTargetWorkingDir): 
     
    93120 
    94121    def _changesetForRevision(self, repo, revision): 
    95         from changes import Changeset, ChangesetEntry 
    96122        from datetime import datetime 
     123        from vcpx.changes import Changeset, ChangesetEntry 
    97124 
    98125        entries = [] 
     
    354381        from os.path import join 
    355382        from re import escape 
    356         from dualwd import IGNORED_METADIRS 
     383        from vcpx.dualwd import IGNORED_METADIRS 
    357384 
    358385        # Create the .hgignore file, that contains a regexp per line 
Note: See TracChangeset for help on using the changeset viewer.