Plugins/VcsPlugins/vcsMercurial/hg.py

changeset 218
633aa53976ae
parent 216
6f9713e8d570
child 219
0553aa793753
equal deleted inserted replaced
217:8ce554fb0bee 218:633aa53976ae
1696 rev, compression, all = dlg.getParameters() 1696 rev, compression, all = dlg.getParameters()
1697 1697
1698 fname, selectedFilter = QFileDialog.getSaveFileNameAndFilter(\ 1698 fname, selectedFilter = QFileDialog.getSaveFileNameAndFilter(\
1699 None, 1699 None,
1700 self.trUtf8("Create changegroup"), 1700 self.trUtf8("Create changegroup"),
1701 None, 1701 repodir,
1702 self.trUtf8("Mercurial Bundle Files (*.hg)"), 1702 self.trUtf8("Mercurial Changegroup Files (*.hg)"),
1703 None, 1703 None,
1704 QFileDialog.Options(QFileDialog.DontConfirmOverwrite)) 1704 QFileDialog.Options(QFileDialog.DontConfirmOverwrite))
1705 1705
1706 if not fname: 1706 if not fname:
1707 return # user aborted 1707 return # user aborted
1712 if ex: 1712 if ex:
1713 fname += ex 1713 fname += ex
1714 if QFileInfo(fname).exists(): 1714 if QFileInfo(fname).exists():
1715 res = QMessageBox.warning(None, 1715 res = QMessageBox.warning(None,
1716 self.trUtf8("Create changegroup"), 1716 self.trUtf8("Create changegroup"),
1717 self.trUtf8("<p>The Mercurial bundle file <b>{0}</b> " 1717 self.trUtf8("<p>The Mercurial changegroup file <b>{0}</b> "
1718 "already exists.</p>") 1718 "already exists.</p>")
1719 .format(fname), 1719 .format(fname),
1720 QMessageBox.StandardButtons(\ 1720 QMessageBox.StandardButtons(\
1721 QMessageBox.Abort | \ 1721 QMessageBox.Abort | \
1722 QMessageBox.Save), 1722 QMessageBox.Save),
1745 def hgPreviewBundle(self, name): 1745 def hgPreviewBundle(self, name):
1746 """ 1746 """
1747 Public method used to view the log of incoming changes from a 1747 Public method used to view the log of incoming changes from a
1748 changegroup file. 1748 changegroup file.
1749 1749
1750 @param name file/directory name to show the log of (string) 1750 @param name directory name on which to base the changegroup (string)
1751 """ 1751 """
1752 file = QFileDialog.getOpenFileName(\ 1752 file = QFileDialog.getOpenFileName(\
1753 None, 1753 None,
1754 self.trUtf8("Preview changegroup"), 1754 self.trUtf8("Preview changegroup"),
1755 "", 1755 repodir,
1756 self.trUtf8("Mercurial Bundle Files (*.hg);;All Files (*)")) 1756 self.trUtf8("Mercurial Changegroup Files (*.hg);;All Files (*)"))
1757 if file: 1757 if file:
1758 if self.getPlugin().getPreferences("UseLogBrowser"): 1758 if self.getPlugin().getPreferences("UseLogBrowser"):
1759 self.logBrowser = \ 1759 self.logBrowser = \
1760 HgLogBrowserDialog(self, mode = "incoming", bundle = file) 1760 HgLogBrowserDialog(self, mode = "incoming", bundle = file)
1761 self.logBrowser.show() 1761 self.logBrowser.show()
1763 else: 1763 else:
1764 self.log = HgLogDialog(self, mode = "incoming", bundle = file) 1764 self.log = HgLogDialog(self, mode = "incoming", bundle = file)
1765 self.log.show() 1765 self.log.show()
1766 self.log.start(name) 1766 self.log.start(name)
1767 1767
1768 def hgIdentifyBundle(self, name):
1769 """
1770 Public method used to identify a changegroup file.
1771
1772 @param name directory name on which to base the changegroup (string)
1773 """
1774 dname, fname = self.splitPath(name)
1775
1776 # find the root of the repo
1777 repodir = str(dname)
1778 while not os.path.isdir(os.path.join(repodir, self.adminDir)):
1779 repodir = os.path.dirname(repodir)
1780 if repodir == os.sep:
1781 return
1782
1783 file = QFileDialog.getOpenFileName(\
1784 None,
1785 self.trUtf8("Preview changegroup"),
1786 repodir,
1787 self.trUtf8("Mercurial Changegroup Files (*.hg);;All Files (*)"))
1788 if file:
1789 args = []
1790 args.append('identify')
1791 args.append(file)
1792
1793 dia = HgDialog(self.trUtf8('Identifying changegroup file'))
1794 res = dia.startProcess(args, repodir, False)
1795 if res:
1796 dia.exec_()
1797
1768 def hgUnbundle(self, name): 1798 def hgUnbundle(self, name):
1769 """ 1799 """
1770 Public method to apply changegroup files. 1800 Public method to apply changegroup files.
1771 1801
1772 @param name file/directory name (string) 1802 @param name file/directory name (string)
1781 return 1811 return
1782 1812
1783 files = QFileDialog.getOpenFileNames(\ 1813 files = QFileDialog.getOpenFileNames(\
1784 None, 1814 None,
1785 self.trUtf8("Apply changegroups"), 1815 self.trUtf8("Apply changegroups"),
1786 "", 1816 repodir,
1787 self.trUtf8("Mercurial Bundle Files (*.hg);;All Files (*)")) 1817 self.trUtf8("Mercurial Changegroup Files (*.hg);;All Files (*)"))
1788 if files: 1818 if files:
1789 update = QMessageBox.question(None, 1819 update = QMessageBox.question(None,
1790 self.trUtf8("Apply changegroups"), 1820 self.trUtf8("Apply changegroups"),
1791 self.trUtf8("""Shall the working directory be updated?"""), 1821 self.trUtf8("""Shall the working directory be updated?"""),
1792 QMessageBox.StandardButtons(\ 1822 QMessageBox.StandardButtons(\

eric ide

mercurial