~ubuntu-branches/debian/sid/tortoisehg/sid

« back to all changes in this revision

Viewing changes to tortoisehg/hgqt/thgrepo.py

  • Committer: Package Import Robot
  • Author(s): Ludovico Cavedon
  • Date: 2012-02-20 22:03:12 UTC
  • mfrom: (1.2.8)
  • Revision ID: package-import@ubuntu.com-20120220220312-11yhqpn8suxvwyg4
Tags: 2.3-1
* Imported Upstream version 2.3 (Closes: #660387, #658140).
* Update dependency on Merurual (2.1, 2.2).

Show diffs side-by-side

added added

removed removed

Lines of Context:
90
90
        else:
91
91
            self.watcher = QFileSystemWatcher(self)
92
92
            self.watcher.addPath(hglib.tounicode(repo.path))
 
93
            self.watcher.addPath(hglib.tounicode(repo.path + '/store'))
93
94
            self.watcher.directoryChanged.connect(self.onDirChange)
94
95
            self.watcher.fileChanged.connect(self.onFileChange)
95
96
            self.addMissingPaths()
169
170
 
170
171
    def _getwatchedfiles(self):
171
172
        watchedfiles = [self.repo.sjoin('00changelog.i')]
 
173
        watchedfiles.append(self.repo.sjoin('phaseroots'))
172
174
        watchedfiles.append(self.repo.join('localtags'))
173
175
        watchedfiles.append(self.repo.join('bookmarks'))
174
176
        watchedfiles.append(self.repo.join('bookmarks.current'))
175
177
        if hasattr(self.repo, 'mq'):
 
178
            watchedfiles.append(self.repo.mq.path)
176
179
            watchedfiles.append(self.repo.mq.join('series'))
177
180
            watchedfiles.append(self.repo.mq.join('guards'))
178
181
            watchedfiles.append(self.repo.join('patches.queue'))
565
568
        
566
569
    return thgrepository
567
570
 
 
571
_maxchangectxclscache = 10
 
572
_changectxclscache = {}  # parentcls: extendedcls
568
573
 
569
574
def _extendchangectx(changectx):
570
 
    class thgchangectx(changectx.__class__):
 
575
    # cache extended changectx class, since we may create bunch of instances
 
576
    parentcls = changectx.__class__
 
577
    try:
 
578
        return _changectxclscache[parentcls]
 
579
    except KeyError:
 
580
        pass
 
581
 
 
582
    # in case each changectx instance is wrapped by some extension, there's
 
583
    # limit on cache size. it may be possible to use weakref.WeakKeyDictionary
 
584
    # on Python 2.5 or later.
 
585
    if len(_changectxclscache) >= _maxchangectxclscache:
 
586
        _changectxclscache.clear()
 
587
    _changectxclscache[parentcls] = cls = _createchangectxcls(parentcls)
 
588
    return cls
 
589
 
 
590
def _createchangectxcls(parentcls):
 
591
    class thgchangectx(parentcls):
 
592
        def sub(self, path):
 
593
            srepo = super(thgchangectx, self).sub(path)
 
594
            if isinstance(srepo, subrepo.hgsubrepo):
 
595
                srepo._repo.__class__ = _extendrepo(srepo._repo)
 
596
            return srepo
 
597
 
571
598
        def thgtags(self):
572
599
            '''Returns all unhidden tags for self'''
573
600
            htlist = self._repo._thghiddentags
650
677
                if self._repo.lfStandin(file) in self.manifest():
651
678
                    return self._repo.lfStandin(file)
652
679
            return self._repo.bfStandin(file)
653
 
                    
 
680
 
654
681
    return thgchangectx
655
682
 
656
683
_pctxcache = {}