Plugins/VcsPlugins/vcsMercurial/hg.py

changeset 202
6854bb0beda5
parent 199
675623ee5d7d
child 205
e5f10cf7fdc9
equal deleted inserted replaced
201:a434e007ab9a 202:6854bb0beda5
1427 dia.exec_() 1427 dia.exec_()
1428 self.checkVCSStatus() 1428 self.checkVCSStatus()
1429 1429
1430 def hgBranch(self, name): 1430 def hgBranch(self, name):
1431 """ 1431 """
1432 Public method used to set the tag in the Mercurial repository. 1432 Public method used to create a branch in the Mercurial repository.
1433 1433
1434 @param name file/directory name to be branched (string) 1434 @param name file/directory name to be branched (string)
1435 """ 1435 """
1436 dname, fname = self.splitPath(name) 1436 dname, fname = self.splitPath(name)
1437 1437
1456 dia = HgDialog(self.trUtf8('Creating branch in the Mercurial repository')) 1456 dia = HgDialog(self.trUtf8('Creating branch in the Mercurial repository'))
1457 res = dia.startProcess(args, repodir) 1457 res = dia.startProcess(args, repodir)
1458 if res: 1458 if res:
1459 dia.exec_() 1459 dia.exec_()
1460 1460
1461 def hgShowBranch(self, name):
1462 """
1463 Public method used to show the current branch the working directory.
1464
1465 @param name file/directory name (string)
1466 """
1467 dname, fname = self.splitPath(name)
1468
1469 # find the root of the repo
1470 repodir = str(dname)
1471 while not os.path.isdir(os.path.join(repodir, self.adminDir)):
1472 repodir = os.path.dirname(repodir)
1473 if repodir == os.sep:
1474 return
1475
1476 args = []
1477 args.append("branch")
1478
1479 dia = HgDialog(self.trUtf8('Showing current branch'))
1480 res = dia.startProcess(args, repodir, False)
1481 if res:
1482 dia.exec_()
1483
1461 def hgEditConfig(self, name): 1484 def hgEditConfig(self, name):
1462 """ 1485 """
1463 Public method used to edit the repository config file. 1486 Public method used to edit the repository config file.
1464 1487
1465 @param name file/directory name (string) 1488 @param name file/directory name (string)
1618 while not os.path.isdir(os.path.join(repodir, self.adminDir)): 1641 while not os.path.isdir(os.path.join(repodir, self.adminDir)):
1619 repodir = os.path.dirname(repodir) 1642 repodir = os.path.dirname(repodir)
1620 if repodir == os.sep: 1643 if repodir == os.sep:
1621 return 1644 return
1622 1645
1623 dlg = HgBundleDialog() 1646 dlg = HgBundleDialog(self.tagsList, self.branchesList)
1624 if dlg.exec_() == QDialog.Accepted: 1647 if dlg.exec_() == QDialog.Accepted:
1625 rev, compression, all = dlg.getParameters() 1648 rev, compression, all = dlg.getParameters()
1626 1649
1627 fname, selectedFilter = QFileDialog.getSaveFileNameAndFilter(\ 1650 fname, selectedFilter = QFileDialog.getSaveFileNameAndFilter(\
1628 None, 1651 None,
1629 self.trUtf8("Mercurial Bundle"), 1652 self.trUtf8("Create changegroup"),
1630 None, 1653 None,
1631 self.trUtf8("Mercurial Bundle Files (*.bundle)"), 1654 self.trUtf8("Mercurial Bundle Files (*.bundle)"),
1632 None, 1655 None,
1633 QFileDialog.Options(QFileDialog.DontConfirmOverwrite)) 1656 QFileDialog.Options(QFileDialog.DontConfirmOverwrite))
1634 1657
1640 ex = selectedFilter.split("(*")[1].split(")")[0] 1663 ex = selectedFilter.split("(*")[1].split(")")[0]
1641 if ex: 1664 if ex:
1642 fname += ex 1665 fname += ex
1643 if QFileInfo(fname).exists(): 1666 if QFileInfo(fname).exists():
1644 res = QMessageBox.warning(None, 1667 res = QMessageBox.warning(None,
1645 self.trUtf8("Mercurial Bundle"), 1668 self.trUtf8("Create changegroup"),
1646 self.trUtf8("<p>The Mercurial bundle file <b>{0}</b> " 1669 self.trUtf8("<p>The Mercurial bundle file <b>{0}</b> "
1647 "already exists.</p>") 1670 "already exists.</p>")
1648 .format(fname), 1671 .format(fname),
1649 QMessageBox.StandardButtons(\ 1672 QMessageBox.StandardButtons(\
1650 QMessageBox.Abort | \ 1673 QMessageBox.Abort | \
1664 if compression: 1687 if compression:
1665 args.append("--type") 1688 args.append("--type")
1666 args.append(compression) 1689 args.append(compression)
1667 args.append(fname) 1690 args.append(fname)
1668 1691
1669 dia = HgDialog(self.trUtf8('Recovering from interrupted transaction')) 1692 dia = HgDialog(self.trUtf8('Create changegroup'))
1670 res = dia.startProcess(args, repodir) 1693 res = dia.startProcess(args, repodir)
1671 if res: 1694 if res:
1672 dia.exec_() 1695 dia.exec_()
1673 1696
1674 def hgUnbundle(self, name): 1697 def hgUnbundle(self, name):
1686 if repodir == os.sep: 1709 if repodir == os.sep:
1687 return 1710 return
1688 1711
1689 files = QFileDialog.getOpenFileNames(\ 1712 files = QFileDialog.getOpenFileNames(\
1690 None, 1713 None,
1691 self.trUtf8("Mercurial Unbundle"), 1714 self.trUtf8("Apply changegroups"),
1692 "", 1715 "",
1693 self.trUtf8("Mercurial Bundle Files (*.bundle);;All Files (*)")) 1716 self.trUtf8("Mercurial Bundle Files (*.bundle);;All Files (*)"))
1694 if files: 1717 if files:
1695 update = QMessageBox.question(None, 1718 update = QMessageBox.question(None,
1696 self.trUtf8("Mercurial Unbundle"), 1719 self.trUtf8("Apply changegroups"),
1697 self.trUtf8("""Shall the working directory be updated?"""), 1720 self.trUtf8("""Shall the working directory be updated?"""),
1698 QMessageBox.StandardButtons(\ 1721 QMessageBox.StandardButtons(\
1699 QMessageBox.No | \ 1722 QMessageBox.No | \
1700 QMessageBox.Yes), 1723 QMessageBox.Yes),
1701 QMessageBox.Yes) == QMessageBox.Yes 1724 QMessageBox.Yes) == QMessageBox.Yes
1704 args.append('unbundle') 1727 args.append('unbundle')
1705 if update: 1728 if update:
1706 args.append("--update") 1729 args.append("--update")
1707 args.extend(files) 1730 args.extend(files)
1708 1731
1709 dia = HgDialog(self.trUtf8('Recovering from interrupted transaction')) 1732 dia = HgDialog(self.trUtf8('Apply changegroups'))
1710 res = dia.startProcess(args, repodir) 1733 res = dia.startProcess(args, repodir)
1711 if res: 1734 if res:
1712 dia.exec_() 1735 dia.exec_()
1736
1737 def hgBisect(self, name, subcommand):
1738 """
1739 Public method to perform bisect commands.
1740
1741 @param name file/directory name (string)
1742 @param subcommand name of the subcommand (string, one of 'good', 'bad',
1743 'skip' or 'reset')
1744 """
1745 if subcommand not in ("good", "bad", "skip", "reset"):
1746 raise ValueError(
1747 self.trUtf8("Bisect subcommand ({0}) invalid.").format(subcommand))
1748
1749 dname, fname = self.splitPath(name)
1750
1751 # find the root of the repo
1752 repodir = str(dname)
1753 while not os.path.isdir(os.path.join(repodir, self.adminDir)):
1754 repodir = os.path.dirname(repodir)
1755 if repodir == os.sep:
1756 return
1757
1758 rev = ""
1759 if subcommand in ("good", "bad"):
1760 dlg = HgRevisionSelectionDialog(self.tagsList, self.branchesList,
1761 showNone =True)
1762 if dlg.exec_() == QDialog.Accepted:
1763 rev = dlg.getRevision()
1764 else:
1765 return
1766
1767 args = []
1768 args.append("bisect")
1769 args.append("--{0}".format(subcommand))
1770 if rev:
1771 args.append(rev)
1772
1773 dia = HgDialog(self.trUtf8('Mercurial Bisect ({0})').format(subcommand))
1774 res = dia.startProcess(args, repodir)
1775 if res:
1776 dia.exec_()
1713 1777
1714 ############################################################################ 1778 ############################################################################
1715 ## Methods to get the helper objects are below. 1779 ## Methods to get the helper objects are below.
1716 ############################################################################ 1780 ############################################################################
1717 1781

eric ide

mercurial