Plugins/VcsPlugins/vcsMercurial/LargefilesExtension/largefiles.py

changeset 3311
b4775920f5b8
parent 3310
a2032ed66aec
child 3313
037642483f35
equal deleted inserted replaced
3310:a2032ed66aec 3311:b4775920f5b8
6 """ 6 """
7 Module implementing the largefiles extension interface. 7 Module implementing the largefiles extension interface.
8 """ 8 """
9 9
10 import os 10 import os
11 import shutil
12 11
13 from PyQt4.QtGui import QDialog 12 from PyQt4.QtGui import QDialog
14 13
15 from E5Gui.E5Application import e5App 14 from E5Gui.E5Application import e5App
16 from E5Gui import E5MessageBox
17 15
18 from ..HgExtension import HgExtension 16 from ..HgExtension import HgExtension
19 from ..HgDialog import HgDialog 17 from ..HgDialog import HgDialog
20
21 from . import getDefaults
22 18
23 19
24 class Largefiles(HgExtension): 20 class Largefiles(HgExtension):
25 """ 21 """
26 Class implementing the largefiles extension interface. 22 Class implementing the largefiles extension interface.
79 os.path.join(newName, self.vcs.adminDir)) 75 os.path.join(newName, self.vcs.adminDir))
80 76
81 # step 2: create working directory contents 77 # step 2: create working directory contents
82 if res: 78 if res:
83 args = self.vcs.initCommand("update") 79 args = self.vcs.initCommand("update")
84 if "-v" not in args and "--verbose" not in args: 80 args.append("--verbose")
85 args.append("-v")
86 dia = HgDialog(self.tr('Convert Project - Extracting'), 81 dia = HgDialog(self.tr('Convert Project - Extracting'),
87 self.vcs, useClient=False) 82 self.vcs, useClient=False)
88 res = dia.startProcess(args, newName) 83 res = dia.startProcess(args, newName)
89 if res: 84 if res:
90 dia.exec_() 85 dia.exec_()
91 res = dia.normalExit() and os.path.isfile(newProjectFile) 86 res = dia.normalExit() and os.path.isfile(newProjectFile)
92 87
93 # step 3: close current project and open new one 88 # step 3: close current project and open new one
94 if res: 89 if res:
95 e5App().getObject("Project").openProject(newProjectFile) 90 e5App().getObject("Project").openProject(newProjectFile)
96 91 if direction == 'largefiles':
97 # step 3.1: copy old hgrc file 92 self.vcs.hgEditConfig(newName, largefilesData={
98 hgrc = os.path.join(repodir, self.vcs.adminDir, "hgrc") 93 "minsize": minSize, "pattern": patterns})
99 if os.path.exists(hgrc): 94 else:
100 ok = E5MessageBox.yesNo( 95 self.vcs.hgEditConfig(newName, withLargefiles=False)
101 None,
102 self.tr("Convert Project"),
103 self.tr("""Shall the Mercurial repository"""
104 """ configuration file be copied over?"""))
105 if ok:
106 shutil.copy(
107 hgrc,
108 os.path.join(newName, self.vcs.adminDir, "hgrc"))
109 # TODO: write patterns to hgrc

eric ide

mercurial