Plugins/VcsPlugins/vcsMercurial/hg.py

changeset 5452
9f89364d9ffd
parent 5389
9b1c800daff3
child 5496
d157a2319073
equal deleted inserted replaced
5451:8ee36e8a315f 5452:9f89364d9ffd
826 project.removeDirectory(name) 826 project.removeDirectory(name)
827 else: 827 else:
828 project.removeFile(name) 828 project.removeFile(name)
829 return res 829 return res
830 830
831 def vcsLog(self, name):
832 """
833 Public method used to view the log of a file/directory from the
834 Mercurial repository.
835
836 @param name file/directory name to show the log of (string)
837 """
838 dname, fname = self.splitPath(name)
839 isFile = os.path.isfile(name)
840
841 # find the root of the repo
842 repodir = dname
843 while not os.path.isdir(os.path.join(repodir, self.adminDir)):
844 repodir = os.path.dirname(repodir)
845 if os.path.splitdrive(repodir)[1] == os.sep:
846 return
847
848 from .HgMultiRevisionSelectionDialog import \
849 HgMultiRevisionSelectionDialog
850 dlg = HgMultiRevisionSelectionDialog(
851 self.hgGetTagsList(repodir),
852 self.hgGetBranchesList(repodir),
853 self.hgGetBookmarksList(repodir),
854 emptyRevsOk=True,
855 showLimit=True,
856 limitDefault=self.getPlugin().getPreferences("LogLimit"))
857 if dlg.exec_() == QDialog.Accepted:
858 revs, noEntries = dlg.getRevisions()
859 from .HgLogDialog import HgLogDialog
860 self.log = HgLogDialog(self, isFile=isFile)
861 self.log.show()
862 self.log.start(name, noEntries=noEntries, revisions=revs)
863
864 def vcsDiff(self, name): 831 def vcsDiff(self, name):
865 """ 832 """
866 Public method used to view the difference of a file/directory to the 833 Public method used to view the difference of a file/directory to the
867 Mercurial repository. 834 Mercurial repository.
868 835
1936 Public method used to view the log of incoming changes from the 1903 Public method used to view the log of incoming changes from the
1937 Mercurial repository. 1904 Mercurial repository.
1938 1905
1939 @param name file/directory name to show the log of (string) 1906 @param name file/directory name to show the log of (string)
1940 """ 1907 """
1941 if self.getPlugin().getPreferences("UseLogBrowser"): 1908 if self.logBrowserIncoming is None:
1942 if self.logBrowserIncoming is None: 1909 from .HgLogBrowserDialog import HgLogBrowserDialog
1943 from .HgLogBrowserDialog import HgLogBrowserDialog 1910 self.logBrowserIncoming = HgLogBrowserDialog(
1944 self.logBrowserIncoming = HgLogBrowserDialog( 1911 self, mode="incoming")
1945 self, mode="incoming") 1912 self.logBrowserIncoming.show()
1946 self.logBrowserIncoming.show() 1913 self.logBrowserIncoming.raise_()
1947 self.logBrowserIncoming.raise_() 1914 self.logBrowserIncoming.start(name)
1948 self.logBrowserIncoming.start(name)
1949 else:
1950 from .HgLogDialog import HgLogDialog
1951 self.log = HgLogDialog(self, mode="incoming")
1952 self.log.show()
1953 self.log.start(name)
1954 1915
1955 def hgOutgoing(self, name): 1916 def hgOutgoing(self, name):
1956 """ 1917 """
1957 Public method used to view the log of outgoing changes from the 1918 Public method used to view the log of outgoing changes from the
1958 Mercurial repository. 1919 Mercurial repository.
1959 1920
1960 @param name file/directory name to show the log of (string) 1921 @param name file/directory name to show the log of (string)
1961 """ 1922 """
1962 if self.getPlugin().getPreferences("UseLogBrowser"): 1923 if self.logBrowserOutgoing is None:
1963 if self.logBrowserOutgoing is None: 1924 from .HgLogBrowserDialog import HgLogBrowserDialog
1964 from .HgLogBrowserDialog import HgLogBrowserDialog 1925 self.logBrowserOutgoing = HgLogBrowserDialog(
1965 self.logBrowserOutgoing = HgLogBrowserDialog( 1926 self, mode="outgoing")
1966 self, mode="outgoing") 1927 self.logBrowserOutgoing.show()
1967 self.logBrowserOutgoing.show() 1928 self.logBrowserOutgoing.raise_()
1968 self.logBrowserOutgoing.raise_() 1929 self.logBrowserOutgoing.start(name)
1969 self.logBrowserOutgoing.start(name)
1970 else:
1971 from .HgLogDialog import HgLogDialog
1972 self.log = HgLogDialog(self, mode="outgoing")
1973 self.log.show()
1974 self.log.start(name)
1975 1930
1976 def hgPull(self, name): 1931 def hgPull(self, name):
1977 """ 1932 """
1978 Public method used to pull changes from a remote Mercurial repository. 1933 Public method used to pull changes from a remote Mercurial repository.
1979 1934
2649 self.__lastChangeGroupPath or repodir, 2604 self.__lastChangeGroupPath or repodir,
2650 self.tr("Mercurial Changegroup Files (*.hg);;All Files (*)")) 2605 self.tr("Mercurial Changegroup Files (*.hg);;All Files (*)"))
2651 if file: 2606 if file:
2652 self.__lastChangeGroupPath = os.path.dirname(file) 2607 self.__lastChangeGroupPath = os.path.dirname(file)
2653 2608
2654 if self.getPlugin().getPreferences("UseLogBrowser"): 2609 if self.logBrowserIncoming is None:
2655 if self.logBrowserIncoming is None: 2610 from .HgLogBrowserDialog import HgLogBrowserDialog
2656 from .HgLogBrowserDialog import HgLogBrowserDialog 2611 self.logBrowserIncoming = \
2657 self.logBrowserIncoming = \ 2612 HgLogBrowserDialog(self, mode="incoming")
2658 HgLogBrowserDialog(self, mode="incoming") 2613 self.logBrowserIncoming.show()
2659 self.logBrowserIncoming.show() 2614 self.logBrowserIncoming.raise_()
2660 self.logBrowserIncoming.raise_() 2615 self.logBrowserIncoming.start(name, bundle=file)
2661 self.logBrowserIncoming.start(name, bundle=file)
2662 else:
2663 from .HgLogDialog import HgLogDialog
2664 self.log = HgLogDialog(self, mode="incoming", bundle=file)
2665 self.log.show()
2666 self.log.start(name)
2667 2616
2668 def hgUnbundle(self, name): 2617 def hgUnbundle(self, name):
2669 """ 2618 """
2670 Public method to apply changegroup files. 2619 Public method to apply changegroup files.
2671 2620

eric ide

mercurial