eric6/Plugins/VcsPlugins/vcsMercurial/hg.py

changeset 7971
ff2971513d6d
parent 7970
c4ee8a81584c
child 7979
54b73174ab61
equal deleted inserted replaced
7970:c4ee8a81584c 7971:ff2971513d6d
328 args.append('--message') 328 args.append('--message')
329 args.append(msg) 329 args.append(msg)
330 dia = HgDialog( 330 dia = HgDialog(
331 self.tr('Initial commit to Mercurial repository'), 331 self.tr('Initial commit to Mercurial repository'),
332 self) 332 self)
333 res = dia.startProcess(args, projectDir) 333 res = dia.startProcess(args)
334 if res: 334 if res:
335 dia.exec() 335 dia.exec()
336 status = dia.normalExit() 336 status = dia.normalExit()
337 337
338 return status, False 338 return status, False
1592 1592
1593 @param name file/directory name to show the log of (string) 1593 @param name file/directory name to show the log of (string)
1594 @param isFile flag indicating log for a file is to be shown 1594 @param isFile flag indicating log for a file is to be shown
1595 (boolean) 1595 (boolean)
1596 """ 1596 """
1597 if name == self.__repoDir:
1598 name = None
1599
1597 if self.logBrowser is None: 1600 if self.logBrowser is None:
1598 from .HgLogBrowserDialog import HgLogBrowserDialog 1601 from .HgLogBrowserDialog import HgLogBrowserDialog
1599 self.logBrowser = HgLogBrowserDialog(self) 1602 self.logBrowser = HgLogBrowserDialog(self)
1600 self.logBrowser.show() 1603 self.logBrowser.show()
1601 self.logBrowser.raise_() 1604 self.logBrowser.raise_()
1893 """ 1896 """
1894 from .HgUserConfigDialog import HgUserConfigDialog 1897 from .HgUserConfigDialog import HgUserConfigDialog
1895 dlg = HgUserConfigDialog(version=self.version) 1898 dlg = HgUserConfigDialog(version=self.version)
1896 dlg.exec() 1899 dlg.exec()
1897 1900
1898 def hgEditConfig(self, name, withLargefiles=True, largefilesData=None): 1901 def hgEditConfig(self, repoName=None,
1902 withLargefiles=True, largefilesData=None):
1899 """ 1903 """
1900 Public method used to edit the repository configuration file. 1904 Public method used to edit the repository configuration file.
1901 1905
1902 @param name file/directory name (string) 1906 @param repoName directory name containing the repository
1907 @type str
1903 @param withLargefiles flag indicating to configure the largefiles 1908 @param withLargefiles flag indicating to configure the largefiles
1904 section (boolean) 1909 section
1910 @type bool
1905 @param largefilesData dictionary with data for the largefiles 1911 @param largefilesData dictionary with data for the largefiles
1906 section of the data dialog (dict) 1912 section of the data dialog
1907 """ 1913 @type dict
1908 dname, fname = self.splitPath(name) 1914 """
1909 1915 if repoName is None:
1910 # find the root of the repo 1916 repoName = self.__repoDir
1911 repodir = dname 1917
1912 while not os.path.isdir(os.path.join(repodir, self.adminDir)): 1918 cfgFile = os.path.join(repoName, self.adminDir, "hgrc")
1913 repodir = os.path.dirname(repodir)
1914 if os.path.splitdrive(repodir)[1] == os.sep:
1915 return
1916
1917 cfgFile = os.path.join(repodir, self.adminDir, "hgrc")
1918 if not os.path.exists(cfgFile): 1919 if not os.path.exists(cfgFile):
1919 # open dialog to enter the initial data 1920 # open dialog to enter the initial data
1920 withLargefiles = (self.isExtensionActive("largefiles") and 1921 withLargefiles = (self.isExtensionActive("largefiles") and
1921 withLargefiles) 1922 withLargefiles)
1922 from .HgRepoConfigDataDialog import HgRepoConfigDataDialog 1923 from .HgRepoConfigDataDialog import HgRepoConfigDataDialog
1948 cfg.write("minsize = {0}\n".format(lfMinSize)) 1949 cfg.write("minsize = {0}\n".format(lfMinSize))
1949 if lfPattern is not None: 1950 if lfPattern is not None:
1950 cfg.write("patterns =\n") 1951 cfg.write("patterns =\n")
1951 cfg.write(" {0}\n".format( 1952 cfg.write(" {0}\n".format(
1952 "\n ".join(lfPattern))) 1953 "\n ".join(lfPattern)))
1953 self.__monitorRepoIniFile(repodir) 1954 self.__monitorRepoIniFile(repoName)
1954 self.__iniFileChanged(cfgFile) 1955 self.__iniFileChanged(cfgFile)
1955 except OSError: 1956 except OSError:
1956 pass 1957 pass
1957 self.repoEditor = MiniEditor(cfgFile, "Properties") 1958 self.repoEditor = MiniEditor(cfgFile, "Properties")
1958 self.repoEditor.show() 1959 self.repoEditor.show()
2604 2605
2605 def hgDeleteBackups(self): 2606 def hgDeleteBackups(self):
2606 """ 2607 """
2607 Public method to delete all backup bundles in the backup area. 2608 Public method to delete all backup bundles in the backup area.
2608 """ 2609 """
2609 # find the root of the repo 2610 backupdir = os.path.join(self.__repodir, self.adminDir, "strip-backup")
2610 repodir = self.__projectHelper.getProject().getProjectPath()
2611 while not os.path.isdir(os.path.join(repodir, self.adminDir)):
2612 repodir = os.path.dirname(repodir)
2613 if os.path.splitdrive(repodir)[1] == os.sep:
2614 return
2615
2616 backupdir = os.path.join(repodir, self.adminDir, "strip-backup")
2617 yes = E5MessageBox.yesNo( 2611 yes = E5MessageBox.yesNo(
2618 self.__ui, 2612 self.__ui,
2619 self.tr("Delete All Backups"), 2613 self.tr("Delete All Backups"),
2620 self.tr("""<p>Do you really want to delete all backup bundles""" 2614 self.tr("""<p>Do you really want to delete all backup bundles"""
2621 """ stored the backup area <b>{0}</b>?</p>""").format( 2615 """ stored the backup area <b>{0}</b>?</p>""").format(

eric ide

mercurial