46 from .HgBundleDialog import HgBundleDialog |
46 from .HgBundleDialog import HgBundleDialog |
47 from .HgBackoutDialog import HgBackoutDialog |
47 from .HgBackoutDialog import HgBackoutDialog |
48 from .HgServeDialog import HgServeDialog |
48 from .HgServeDialog import HgServeDialog |
49 from .HgUtilities import getConfigPath |
49 from .HgUtilities import getConfigPath |
50 from .HgClient import HgClient |
50 from .HgClient import HgClient |
|
51 from .HgImportDialog import HgImportDialog |
51 |
52 |
52 from .BookmarksExtension.bookmarks import Bookmarks |
53 from .BookmarksExtension.bookmarks import Bookmarks |
53 from .QueuesExtension.queues import Queues |
54 from .QueuesExtension.queues import Queues |
54 from .FetchExtension.fetch import Fetch |
55 from .FetchExtension.fetch import Fetch |
55 from .PurgeExtension.purge import Purge |
56 from .PurgeExtension.purge import Purge |
827 dia = HgDialog(self.trUtf8('Taging in the Mercurial repository'), self) |
828 dia = HgDialog(self.trUtf8('Taging in the Mercurial repository'), self) |
828 res = dia.startProcess(args, repodir) |
829 res = dia.startProcess(args, repodir) |
829 if res: |
830 if res: |
830 dia.exec_() |
831 dia.exec_() |
831 |
832 |
832 def vcsRevert(self, name): |
833 def hgRevert(self, name): |
833 """ |
834 """ |
834 Public method used to revert changes made to a file/directory. |
835 Public method used to revert changes made to a file/directory. |
835 |
836 |
836 @param name file/directory name to be reverted (string) |
837 @param name file/directory name to be reverted (string) |
|
838 @return flag indicating, that the update contained an add |
|
839 or delete (boolean) |
837 """ |
840 """ |
838 args = [] |
841 args = [] |
839 args.append('revert') |
842 args.append('revert') |
840 self.addArguments(args, self.options['global']) |
843 self.addArguments(args, self.options['global']) |
841 args.append("--no-backup") |
844 args.append("--no-backup") |
850 # find the root of the repo |
853 # find the root of the repo |
851 repodir = dname |
854 repodir = dname |
852 while not os.path.isdir(os.path.join(repodir, self.adminDir)): |
855 while not os.path.isdir(os.path.join(repodir, self.adminDir)): |
853 repodir = os.path.dirname(repodir) |
856 repodir = os.path.dirname(repodir) |
854 if repodir == os.sep: |
857 if repodir == os.sep: |
855 return |
858 return False |
856 |
859 |
857 dia = HgDialog(self.trUtf8('Reverting changes'), self) |
860 dia = HgDialog(self.trUtf8('Reverting changes'), self) |
858 res = dia.startProcess(args, repodir) |
861 res = dia.startProcess(args, repodir) |
859 if res: |
862 if res: |
860 dia.exec_() |
863 dia.exec_() |
|
864 res = dia.hasAddOrDelete() |
861 self.checkVCSStatus() |
865 self.checkVCSStatus() |
|
866 return res |
862 |
867 |
863 def vcsMerge(self, name): |
868 def vcsMerge(self, name): |
864 """ |
869 """ |
865 Public method used to merge a URL/revision into the local project. |
870 Public method used to merge a URL/revision into the local project. |
866 |
871 |
1590 # find the root of the repo |
1595 # find the root of the repo |
1591 repodir = self.splitPath(name)[0] |
1596 repodir = self.splitPath(name)[0] |
1592 while not os.path.isdir(os.path.join(repodir, self.adminDir)): |
1597 while not os.path.isdir(os.path.join(repodir, self.adminDir)): |
1593 repodir = os.path.dirname(repodir) |
1598 repodir = os.path.dirname(repodir) |
1594 if repodir == os.sep: |
1599 if repodir == os.sep: |
1595 return |
1600 return False |
1596 |
1601 |
1597 dia = HgDialog(title, self) |
1602 dia = HgDialog(title, self) |
1598 res = dia.startProcess(args, repodir) |
1603 res = dia.startProcess(args, repodir) |
1599 if res: |
1604 if res: |
1600 dia.exec_() |
1605 dia.exec_() |
2367 return |
2372 return |
2368 |
2373 |
2369 self.serveDlg = HgServeDialog(self, repodir) |
2374 self.serveDlg = HgServeDialog(self, repodir) |
2370 self.serveDlg.show() |
2375 self.serveDlg.show() |
2371 |
2376 |
|
2377 def hgImport(self, name): |
|
2378 """ |
|
2379 Public method to import a patch file. |
|
2380 |
|
2381 @param name directory name of the project to import into (string) |
|
2382 @return flag indicating, that the import contained an add, a delete |
|
2383 or a change to the project file (boolean) |
|
2384 """ |
|
2385 dname, fname = self.splitPath(name) |
|
2386 |
|
2387 # find the root of the repo |
|
2388 repodir = dname |
|
2389 while not os.path.isdir(os.path.join(repodir, self.adminDir)): |
|
2390 repodir = os.path.dirname(repodir) |
|
2391 if repodir == os.sep: |
|
2392 return |
|
2393 |
|
2394 dlg = HgImportDialog() |
|
2395 if dlg.exec_() == QDialog.Accepted: |
|
2396 patchFile, noCommit, message, date, user, stripCount, force = \ |
|
2397 dlg.getParameters() |
|
2398 |
|
2399 args = [] |
|
2400 args.append("import") |
|
2401 args.append("--verbose") |
|
2402 if noCommit: |
|
2403 args.append("--no-commit") |
|
2404 else: |
|
2405 if message: |
|
2406 args.append('--message') |
|
2407 args.append(message) |
|
2408 if date: |
|
2409 args.append('--date') |
|
2410 args.append(date) |
|
2411 if user: |
|
2412 args.append('--user') |
|
2413 args.append(user) |
|
2414 if stripCount != 1: |
|
2415 args.append("--strip") |
|
2416 args.append(str(stripCount)) |
|
2417 if force: |
|
2418 args.append("--force") |
|
2419 args.append(patchFile) |
|
2420 |
|
2421 dia = HgDialog(self.trUtf8("Import Patch"), self) |
|
2422 res = dia.startProcess(args, repodir) |
|
2423 if res: |
|
2424 dia.exec_() |
|
2425 res = dia.hasAddOrDelete() |
|
2426 self.checkVCSStatus() |
|
2427 else: |
|
2428 res = False |
|
2429 |
|
2430 return res |
|
2431 |
2372 ############################################################################ |
2432 ############################################################################ |
2373 ## Methods to handle extensions are below. |
2433 ## Methods to handle extensions are below. |
2374 ############################################################################ |
2434 ############################################################################ |
2375 |
2435 |
2376 def __iniFileChanged(self, path): |
2436 def __iniFileChanged(self, path): |