1001 |
1001 |
1002 def vcsRegisteredState(self, name): |
1002 def vcsRegisteredState(self, name): |
1003 """ |
1003 """ |
1004 Public method used to get the registered state of a file in the vcs. |
1004 Public method used to get the registered state of a file in the vcs. |
1005 |
1005 |
1006 @param name filename to check (string) |
1006 @param name file or directory name to check |
|
1007 @type str |
1007 @return a combination of canBeCommited and canBeAdded |
1008 @return a combination of canBeCommited and canBeAdded |
|
1009 @rtype int |
1008 """ |
1010 """ |
1009 if name.endswith(os.sep): |
1011 if name.endswith(os.sep): |
1010 name = name[:-1] |
1012 name = name[:-1] |
1011 name = os.path.normcase(name) |
1013 name = os.path.normcase(name) |
1012 dname, fname = self.splitPath(name) |
1014 |
1013 |
1015 if ( |
1014 if fname == '.' and os.path.isdir(os.path.join(dname, self.adminDir)): |
1016 os.path.isdir(name) and |
|
1017 os.path.isdir(os.path.join(name, self.adminDir)) |
|
1018 ): |
1015 return self.canBeCommitted |
1019 return self.canBeCommitted |
1016 |
1020 |
1017 if name in self.statusCache: |
1021 if name in self.statusCache: |
1018 return self.statusCache[name] |
1022 return self.statusCache[name] |
1019 |
|
1020 # find the root of the repo |
|
1021 repodir = dname |
|
1022 while not os.path.isdir(os.path.join(repodir, self.adminDir)): |
|
1023 repodir = os.path.dirname(repodir) |
|
1024 if os.path.splitdrive(repodir)[1] == os.sep: |
|
1025 return 0 |
|
1026 |
|
1027 args = self.initCommand("status") |
1023 args = self.initCommand("status") |
1028 args.append('--all') |
1024 args.append('--all') |
1029 args.append('--noninteractive') |
1025 args.append('--noninteractive') |
1030 |
1026 |
1031 output, error = self.__client.runcommand(args) |
1027 output, error = self.__client.runcommand(args) |
1032 |
1028 |
1033 if output: |
1029 if output: |
|
1030 repodir = self.getClient().getRepository() |
1034 for line in output.splitlines(): |
1031 for line in output.splitlines(): |
1035 if len(line) > 2 and line[0] in "MARC!?I" and line[1] == " ": |
1032 if len(line) > 2 and line[0] in "MARC!?I" and line[1] == " ": |
1036 flag, path = line.split(" ", 1) |
1033 flag, path = line.split(" ", 1) |
1037 absname = os.path.join(repodir, os.path.normcase(path)) |
1034 absname = Utilities.normcasepath( |
1038 if flag not in "?I": |
1035 os.path.join(repodir, path)) |
1039 if fname == '.': |
1036 if flag not in "?I" and absname == name: |
1040 if absname.startswith(dname + os.path.sep): |
1037 return self.canBeCommitted |
1041 return self.canBeCommitted |
|
1042 if absname == dname: |
|
1043 return self.canBeCommitted |
|
1044 else: |
|
1045 if absname == name: |
|
1046 return self.canBeCommitted |
|
1047 |
1038 |
1048 return self.canBeAdded |
1039 return self.canBeAdded |
1049 |
1040 |
1050 def vcsAllRegisteredStates(self, names, dname, shortcut=True): |
1041 def vcsAllRegisteredStates(self, names, dname, shortcut=True): |
1051 """ |
1042 """ |
1071 if name in names: |
1062 if name in names: |
1072 found = True |
1063 found = True |
1073 names[name] = self.statusCache[name] |
1064 names[name] = self.statusCache[name] |
1074 |
1065 |
1075 if not found: |
1066 if not found: |
1076 # find the root of the repo |
|
1077 repodir = dname |
|
1078 while not os.path.isdir(os.path.join(repodir, self.adminDir)): |
|
1079 repodir = os.path.dirname(repodir) |
|
1080 if os.path.splitdrive(repodir)[1] == os.sep: |
|
1081 return names |
|
1082 |
|
1083 args = self.initCommand("status") |
1067 args = self.initCommand("status") |
1084 args.append('--all') |
1068 args.append('--all') |
1085 args.append('--noninteractive') |
1069 args.append('--noninteractive') |
1086 |
1070 |
1087 output, error = self.__client.runcommand(args) |
1071 output, error = self.__client.runcommand(args) |
1088 |
1072 |
1089 if output: |
1073 if output: |
|
1074 repoPath = self.getClient().getRepository() |
1090 dirs = [x for x in names.keys() if os.path.isdir(x)] |
1075 dirs = [x for x in names.keys() if os.path.isdir(x)] |
1091 for line in output.splitlines(): |
1076 for line in output.splitlines(): |
1092 if line and line[0] in "MARC!?I": |
1077 if line and line[0] in "MARC!?I": |
1093 flag, path = line.split(" ", 1) |
1078 flag, path = line.split(" ", 1) |
1094 name = os.path.normcase(os.path.join(repodir, path)) |
1079 name = os.path.normcase(os.path.join(repoPath, path)) |
1095 dirName = os.path.dirname(name) |
1080 dirName = os.path.dirname(name) |
1096 if name.startswith(dname): |
1081 if name.startswith(dname): |
1097 if flag not in "?I": |
1082 if flag not in "?I": |
1098 if name in names: |
1083 if name in names: |
1099 names[name] = self.canBeCommitted |
1084 names[name] = self.canBeCommitted |
1911 @param largefilesData dictionary with data for the largefiles |
1896 @param largefilesData dictionary with data for the largefiles |
1912 section of the data dialog |
1897 section of the data dialog |
1913 @type dict |
1898 @type dict |
1914 """ |
1899 """ |
1915 if repoName is None: |
1900 if repoName is None: |
1916 repoName = self.__repoDir |
1901 repoName = self.getClient().getRepository() |
1917 |
1902 |
1918 cfgFile = os.path.join(repoName, self.adminDir, "hgrc") |
1903 cfgFile = os.path.join(repoName, self.adminDir, "hgrc") |
1919 if not os.path.exists(cfgFile): |
1904 if not os.path.exists(cfgFile): |
1920 # open dialog to enter the initial data |
1905 # open dialog to enter the initial data |
1921 withLargefiles = (self.isExtensionActive("largefiles") and |
1906 withLargefiles = (self.isExtensionActive("largefiles") and |
2326 dia = HgDialog(self.tr('Rollback last transaction'), self) |
2311 dia = HgDialog(self.tr('Rollback last transaction'), self) |
2327 res = dia.startProcess(["rollback"]) |
2312 res = dia.startProcess(["rollback"]) |
2328 if res: |
2313 if res: |
2329 dia.exec() |
2314 dia.exec() |
2330 |
2315 |
2331 def hgServe(self, name): |
2316 def hgServe(self, repoPath): |
2332 """ |
2317 """ |
2333 Public method used to serve the project. |
2318 Public method used to serve the project. |
2334 |
2319 |
2335 @param name directory name (string) |
2320 @param repoPath directory containing the repository |
2336 """ |
2321 @type str |
2337 dname, fname = self.splitPath(name) |
2322 """ |
2338 |
|
2339 # find the root of the repo |
|
2340 repodir = dname |
|
2341 while not os.path.isdir(os.path.join(repodir, self.adminDir)): |
|
2342 repodir = os.path.dirname(repodir) |
|
2343 if os.path.splitdrive(repodir)[1] == os.sep: |
|
2344 return |
|
2345 |
|
2346 from .HgServeDialog import HgServeDialog |
2323 from .HgServeDialog import HgServeDialog |
2347 self.serveDlg = HgServeDialog(self, repodir) |
2324 self.serveDlg = HgServeDialog(self, repoPath) |
2348 self.serveDlg.show() |
2325 self.serveDlg.show() |
2349 |
2326 |
2350 def hgImport(self): |
2327 def hgImport(self): |
2351 """ |
2328 """ |
2352 Public method to import a patch file. |
2329 Public method to import a patch file. |
2605 |
2582 |
2606 def hgDeleteBackups(self): |
2583 def hgDeleteBackups(self): |
2607 """ |
2584 """ |
2608 Public method to delete all backup bundles in the backup area. |
2585 Public method to delete all backup bundles in the backup area. |
2609 """ |
2586 """ |
2610 backupdir = os.path.join(self.__repodir, self.adminDir, "strip-backup") |
2587 backupdir = os.path.join(self.getClient().getRepository(), |
|
2588 self.adminDir, "strip-backup") |
2611 yes = E5MessageBox.yesNo( |
2589 yes = E5MessageBox.yesNo( |
2612 self.__ui, |
2590 self.__ui, |
2613 self.tr("Delete All Backups"), |
2591 self.tr("Delete All Backups"), |
2614 self.tr("""<p>Do you really want to delete all backup bundles""" |
2592 self.tr("""<p>Do you really want to delete all backup bundles""" |
2615 """ stored the backup area <b>{0}</b>?</p>""").format( |
2593 """ stored the backup area <b>{0}</b>?</p>""").format( |
2840 if self.__repoIniFile and path == self.__repoIniFile: |
2818 if self.__repoIniFile and path == self.__repoIniFile: |
2841 self.__checkDefaults() |
2819 self.__checkDefaults() |
2842 |
2820 |
2843 self.iniFileChanged.emit() |
2821 self.iniFileChanged.emit() |
2844 |
2822 |
2845 def __monitorRepoIniFile(self, name): |
2823 def __monitorRepoIniFile(self, repodir): |
2846 """ |
2824 """ |
2847 Private slot to add a repository configuration file to the list of |
2825 Private slot to add a repository configuration file to the list of |
2848 monitored files. |
2826 monitored files. |
2849 |
2827 |
2850 @param name directory name pointing into the repository (string) |
2828 @param repodir directory name of the repository |
2851 """ |
2829 @type str |
2852 dname, fname = self.splitPath(name) |
2830 """ |
2853 |
|
2854 # find the root of the repo |
|
2855 repodir = dname |
|
2856 while not os.path.isdir(os.path.join(repodir, self.adminDir)): |
|
2857 repodir = os.path.dirname(repodir) |
|
2858 if not repodir or os.path.splitdrive(repodir)[1] == os.sep: |
|
2859 return |
|
2860 |
|
2861 cfgFile = os.path.join(repodir, self.adminDir, "hgrc") |
2831 cfgFile = os.path.join(repodir, self.adminDir, "hgrc") |
2862 if os.path.exists(cfgFile): |
2832 if os.path.exists(cfgFile): |
2863 self.__iniWatcher.addPath(cfgFile) |
2833 self.__iniWatcher.addPath(cfgFile) |
2864 self.__repoIniFile = cfgFile |
2834 self.__repoIniFile = cfgFile |
2865 self.__checkDefaults() |
2835 self.__checkDefaults() |