Plugins/VcsPlugins/vcsMercurial/hg.py

changeset 219
0553aa793753
parent 218
633aa53976ae
child 240
b0d829cf4234
equal deleted inserted replaced
218:633aa53976ae 219:0553aa793753
37 from .HgAnnotateDialog import HgAnnotateDialog 37 from .HgAnnotateDialog import HgAnnotateDialog
38 from .HgTagDialog import HgTagDialog 38 from .HgTagDialog import HgTagDialog
39 from .HgTagBranchListDialog import HgTagBranchListDialog 39 from .HgTagBranchListDialog import HgTagBranchListDialog
40 from .HgCommandDialog import HgCommandDialog 40 from .HgCommandDialog import HgCommandDialog
41 from .HgBundleDialog import HgBundleDialog 41 from .HgBundleDialog import HgBundleDialog
42 from .HgBackoutDialog import HgBackoutDialog
42 43
43 from .ProjectBrowserHelper import HgProjectBrowserHelper 44 from .ProjectBrowserHelper import HgProjectBrowserHelper
44 45
45 import Preferences 46 import Preferences
46 import Utilities 47 import Utilities
1288 """ 1289 """
1289 args = [] 1290 args = []
1290 args.append('pull') 1291 args.append('pull')
1291 self.addArguments(args, self.options['global']) 1292 self.addArguments(args, self.options['global'])
1292 args.append('-v') 1293 args.append('-v')
1294 if self.getPlugin().getPreferences("PullUpdate"):
1295 args.append('--update')
1293 1296
1294 # find the root of the repo 1297 # find the root of the repo
1295 repodir = self.splitPath(name)[0] 1298 repodir = self.splitPath(name)[0]
1296 while not os.path.isdir(os.path.join(repodir, self.adminDir)): 1299 while not os.path.isdir(os.path.join(repodir, self.adminDir)):
1297 repodir = os.path.dirname(repodir) 1300 repodir = os.path.dirname(repodir)
1747 Public method used to view the log of incoming changes from a 1750 Public method used to view the log of incoming changes from a
1748 changegroup file. 1751 changegroup file.
1749 1752
1750 @param name directory name on which to base the changegroup (string) 1753 @param name directory name on which to base the changegroup (string)
1751 """ 1754 """
1755 dname, fname = self.splitPath(name)
1756
1757 # find the root of the repo
1758 repodir = str(dname)
1759 while not os.path.isdir(os.path.join(repodir, self.adminDir)):
1760 repodir = os.path.dirname(repodir)
1761 if repodir == os.sep:
1762 return
1763
1752 file = QFileDialog.getOpenFileName(\ 1764 file = QFileDialog.getOpenFileName(\
1753 None, 1765 None,
1754 self.trUtf8("Preview changegroup"), 1766 self.trUtf8("Preview changegroup"),
1755 repodir, 1767 repodir,
1756 self.trUtf8("Mercurial Changegroup Files (*.hg);;All Files (*)")) 1768 self.trUtf8("Mercurial Changegroup Files (*.hg);;All Files (*)"))
1797 1809
1798 def hgUnbundle(self, name): 1810 def hgUnbundle(self, name):
1799 """ 1811 """
1800 Public method to apply changegroup files. 1812 Public method to apply changegroup files.
1801 1813
1802 @param name file/directory name (string) 1814 @param name directory name (string)
1803 """ 1815 """
1804 dname, fname = self.splitPath(name) 1816 dname, fname = self.splitPath(name)
1805 1817
1806 # find the root of the repo 1818 # find the root of the repo
1807 repodir = str(dname) 1819 repodir = str(dname)
1899 # find the root of the repo 1911 # find the root of the repo
1900 repodir = dname 1912 repodir = dname
1901 while not os.path.isdir(os.path.join(repodir, self.adminDir)): 1913 while not os.path.isdir(os.path.join(repodir, self.adminDir)):
1902 repodir = os.path.dirname(repodir) 1914 repodir = os.path.dirname(repodir)
1903 if repodir == os.sep: 1915 if repodir == os.sep:
1904 return False 1916 return
1905 1917
1906 dia = HgDialog(\ 1918 dia = HgDialog(\
1907 self.trUtf8('Removing files from the Mercurial repository only')) 1919 self.trUtf8('Removing files from the Mercurial repository only'))
1908 res = dia.startProcess(args, repodir) 1920 res = dia.startProcess(args, repodir)
1909 if res: 1921 if res:
1911 if isinstance(name, list): 1923 if isinstance(name, list):
1912 self.__forgotNames.extend(name) 1924 self.__forgotNames.extend(name)
1913 else: 1925 else:
1914 self.__forgotNames.append(name) 1926 self.__forgotNames.append(name)
1915 1927
1928 def hgBackout(self, name):
1929 """
1930 Public method used to backout an earlier changeset from the Mercurial repository.
1931
1932 @param name directory name (string or list of strings))
1933 """
1934 dname, fname = self.splitPath(name)
1935
1936 # find the root of the repo
1937 repodir = str(dname)
1938 while not os.path.isdir(os.path.join(repodir, self.adminDir)):
1939 repodir = os.path.dirname(repodir)
1940 if repodir == os.sep:
1941 return
1942
1943 dlg = HgBackoutDialog(self.tagsList, self.branchesList)
1944 if dlg.exec_() == QDialog.Accepted:
1945 rev, merge, date, user, message = dlg.getParameters()
1946 if not rev:
1947 QMessageBox.warning(None,
1948 self.trUtf8("Backing out changeset"),
1949 self.trUtf8("""No revision given. Aborting..."""))
1950 return
1951
1952 args = []
1953 args.append('backout')
1954 args.append('-v')
1955 if merge:
1956 args.append('--merge')
1957 if date:
1958 args.append('--date')
1959 args.append(date)
1960 if user:
1961 args.append('--user')
1962 args.append(user)
1963 args.append('--message')
1964 args.append(message)
1965 args.append(rev)
1966
1967 dia = HgDialog(self.trUtf8('Backing out changeset'))
1968 res = dia.startProcess(args, repodir)
1969 if res:
1970 dia.exec_()
1971
1916 ############################################################################ 1972 ############################################################################
1917 ## Methods to get the helper objects are below. 1973 ## Methods to get the helper objects are below.
1918 ############################################################################ 1974 ############################################################################
1919 1975
1920 def vcsGetProjectBrowserHelper(self, browser, project, isTranslationsBrowser = False): 1976 def vcsGetProjectBrowserHelper(self, browser, project, isTranslationsBrowser = False):

eric ide

mercurial