src/eric7/VCS/VersionControl.py

branch
eric7
changeset 10436
f6881d10e995
parent 10069
435cc5875135
child 10438
4cd7e5a8b3cf
equal deleted inserted replaced
10435:c712d09cc839 10436:f6881d10e995
64 64
65 def __init__(self, parent=None, name=None): 65 def __init__(self, parent=None, name=None):
66 """ 66 """
67 Constructor 67 Constructor
68 68
69 @param parent parent widget (QWidget) 69 @param parent parent widget
70 @param name name of this object (string) 70 @type QWidget
71 @param name name of this object
72 @type str
71 """ 73 """
72 super().__init__(parent) 74 super().__init__(parent)
73 if name: 75 if name:
74 self.setObjectName(name) 76 self.setObjectName(name)
75 self.defaultOptions = { 77 self.defaultOptions = {
105 107
106 def vcsExists(self): 108 def vcsExists(self):
107 """ 109 """
108 Public method used to test for the presence of the vcs. 110 Public method used to test for the presence of the vcs.
109 111
110 @return tuple of flag indicating the existence and a string 112 @return tuple of flag indicating the existence and an error message
111 giving an error message in case of failure 113 in case of failure
114 @rtype tuple of (bool, str)
112 @exception NotImplementedError to indicate that this method must be 115 @exception NotImplementedError to indicate that this method must be
113 implemented by a subclass 116 implemented by a subclass
114 """ 117 """
115 raise NotImplementedError("Not implemented") 118 raise NotImplementedError("Not implemented")
116 119
118 121
119 def vcsInit(self, vcsDir, noDialog=False): 122 def vcsInit(self, vcsDir, noDialog=False):
120 """ 123 """
121 Public method used to initialize the vcs. 124 Public method used to initialize the vcs.
122 125
123 @param vcsDir name of the VCS directory (string) 126 @param vcsDir name of the VCS directory
124 @param noDialog flag indicating quiet operations (boolean) 127 @type str
125 @return flag indicating success (boolean) 128 @param noDialog flag indicating quiet operations
129 @type bool
130 @return flag indicating success
131 @rtype bool
126 @exception NotImplementedError to indicate that this method must be 132 @exception NotImplementedError to indicate that this method must be
127 implemented by a subclass 133 implemented by a subclass
128 """ 134 """
129 raise NotImplementedError("Not implemented") 135 raise NotImplementedError("Not implemented")
130 136
150 """ 156 """
151 Public method used to import the project into the vcs. 157 Public method used to import the project into the vcs.
152 158
153 @param vcsDataDict dictionary of data required for the import 159 @param vcsDataDict dictionary of data required for the import
154 @type dict 160 @type dict
155 @param projectDir project directory (string) 161 @param projectDir project directory
156 @type str 162 @type str
157 @param noDialog flag indicating quiet operations 163 @param noDialog flag indicating quiet operations
158 @type bool 164 @type bool
159 @param addAll flag indicating to add all files to the repository 165 @param addAll flag indicating to add all files to the repository
160 @type bool 166 @type bool
171 def vcsCheckout(self, vcsDataDict, projectDir, noDialog=False): 177 def vcsCheckout(self, vcsDataDict, projectDir, noDialog=False):
172 """ 178 """
173 Public method used to check the project out of the vcs. 179 Public method used to check the project out of the vcs.
174 180
175 @param vcsDataDict dictionary of data required for the checkout 181 @param vcsDataDict dictionary of data required for the checkout
176 @param projectDir project directory to create (string) 182 @type dict
183 @param projectDir project directory to create
184 @type str
177 @param noDialog flag indicating quiet operations 185 @param noDialog flag indicating quiet operations
178 @return flag indicating an execution without errors (boolean) 186 @type bool
187 @return flag indicating an execution without errors
188 @rtype bool
179 @exception NotImplementedError to indicate that this method must be 189 @exception NotImplementedError to indicate that this method must be
180 implemented by a subclass 190 implemented by a subclass
181 """ 191 """
182 raise NotImplementedError("Not implemented") 192 raise NotImplementedError("Not implemented")
183 193
186 def vcsExport(self, vcsDataDict, projectDir): 196 def vcsExport(self, vcsDataDict, projectDir):
187 """ 197 """
188 Public method used to export a directory from the vcs. 198 Public method used to export a directory from the vcs.
189 199
190 @param vcsDataDict dictionary of data required for the export 200 @param vcsDataDict dictionary of data required for the export
191 @param projectDir project directory to create (string) 201 @type dict
192 @return flag indicating an execution without errors (boolean) 202 @param projectDir project directory to create
203 @type str
204 @return flag indicating an execution without errors
205 @rtype bool
193 @exception NotImplementedError to indicate that this method must be 206 @exception NotImplementedError to indicate that this method must be
194 implemented by a subclass 207 implemented by a subclass
195 """ 208 """
196 raise NotImplementedError("Not implemented") 209 raise NotImplementedError("Not implemented")
197 210
200 def vcsCommit(self, name, message, noDialog=False): 213 def vcsCommit(self, name, message, noDialog=False):
201 """ 214 """
202 Public method used to make the change of a file/directory permanent in 215 Public method used to make the change of a file/directory permanent in
203 the vcs. 216 the vcs.
204 217
205 @param name file/directory name to be committed (string) 218 @param name file/directory name to be committed
206 @param message message for this operation (string) 219 @type str
207 @param noDialog flag indicating quiet operations (boolean) 220 @param message message for this operation
208 @return flag indicating success (boolean) 221 @type str
222 @param noDialog flag indicating quiet operations
223 @type bool
224 @return flag indicating success
225 @rtype bool
209 @exception NotImplementedError to indicate that this method must be 226 @exception NotImplementedError to indicate that this method must be
210 implemented by a subclass 227 implemented by a subclass
211 """ 228 """
212 raise NotImplementedError("Not implemented") 229 raise NotImplementedError("Not implemented")
213 230
327 344
328 def vcsUpdate(self, name, noDialog=False): 345 def vcsUpdate(self, name, noDialog=False):
329 """ 346 """
330 Public method used to update a file/directory in the vcs. 347 Public method used to update a file/directory in the vcs.
331 348
332 @param name file/directory name to be updated (string) 349 @param name file/directory name to be updated
333 @param noDialog flag indicating quiet operations (boolean) 350 @type str
351 @param noDialog flag indicating quiet operations
352 @type bool
334 @return flag indicating, that the update contained an add 353 @return flag indicating, that the update contained an add
335 or delete (boolean) 354 or delete
355 @rtype bool
336 @exception NotImplementedError to indicate that this method must be 356 @exception NotImplementedError to indicate that this method must be
337 implemented by a subclass 357 implemented by a subclass
338 """ 358 """
339 raise NotImplementedError("Not implemented") 359 raise NotImplementedError("Not implemented")
340 360
342 362
343 def vcsAdd(self, name, isDir=False, noDialog=False): 363 def vcsAdd(self, name, isDir=False, noDialog=False):
344 """ 364 """
345 Public method used to add a file/directory in the vcs. 365 Public method used to add a file/directory in the vcs.
346 366
347 @param name file/directory name to be added (string) 367 @param name file/directory name to be added
348 @param isDir flag indicating name is a directory (boolean) 368 @type str
349 @param noDialog flag indicating quiet operations (boolean) 369 @param isDir flag indicating name is a directory
370 @type bool
371 @param noDialog flag indicating quiet operations
372 @type bool
350 @exception NotImplementedError to indicate that this method must be 373 @exception NotImplementedError to indicate that this method must be
351 implemented by a subclass 374 implemented by a subclass
352 """ 375 """
353 raise NotImplementedError("Not implemented") 376 raise NotImplementedError("Not implemented")
354 377
355 def vcsAddBinary(self, name, isDir=False): 378 def vcsAddBinary(self, name, isDir=False):
356 """ 379 """
357 Public method used to add a file/directory in binary mode in the vcs. 380 Public method used to add a file/directory in binary mode in the vcs.
358 381
359 @param name file/directory name to be added (string) 382 @param name file/directory name to be added
360 @param isDir flag indicating name is a directory (boolean) 383 @type str
384 @param isDir flag indicating name is a directory
385 @type bool
361 @exception NotImplementedError to indicate that this method must be 386 @exception NotImplementedError to indicate that this method must be
362 implemented by a subclass 387 implemented by a subclass
363 """ 388 """
364 raise NotImplementedError("Not implemented") 389 raise NotImplementedError("Not implemented")
365 390
366 def vcsAddTree(self, path): 391 def vcsAddTree(self, path):
367 """ 392 """
368 Public method to add a directory tree rooted at path in the vcs. 393 Public method to add a directory tree rooted at path in the vcs.
369 394
370 @param path root directory of the tree to be added (string) 395 @param path root directory of the tree to be added
396 @type str
371 @exception NotImplementedError to indicate that this method must be 397 @exception NotImplementedError to indicate that this method must be
372 implemented by a subclass 398 implemented by a subclass
373 """ 399 """
374 raise NotImplementedError("Not implemented") 400 raise NotImplementedError("Not implemented")
375 401
376 def vcsRemove(self, name, project=False, noDialog=False): 402 def vcsRemove(self, name, project=False, noDialog=False):
377 """ 403 """
378 Public method used to add a file/directory in the vcs. 404 Public method used to add a file/directory in the vcs.
379 405
380 @param name file/directory name to be removed (string) 406 @param name file/directory name to be removed
381 @param project flag indicating deletion of a project tree (boolean) 407 @type str
408 @param project flag indicating deletion of a project tree
409 @type bool
382 @param noDialog flag indicating quiet operations 410 @param noDialog flag indicating quiet operations
383 @return flag indicating success (boolean) 411 @type bool
412 @return flag indicating success
413 @rtype bool
384 @exception NotImplementedError to indicate that this method must be 414 @exception NotImplementedError to indicate that this method must be
385 implemented by a subclass 415 implemented by a subclass
386 """ 416 """
387 raise NotImplementedError("Not implemented") 417 raise NotImplementedError("Not implemented")
388 418
390 420
391 def vcsMove(self, name, project, target=None, noDialog=False): 421 def vcsMove(self, name, project, target=None, noDialog=False):
392 """ 422 """
393 Public method used to move a file/directory. 423 Public method used to move a file/directory.
394 424
395 @param name file/directory name to be moved (string) 425 @param name file/directory name to be moved
426 @type str
396 @param project reference to the project object 427 @param project reference to the project object
397 @param target new name of the file/directory (string) 428 @type Project
429 @param target new name of the file/directory
430 @type str
398 @param noDialog flag indicating quiet operations 431 @param noDialog flag indicating quiet operations
399 @return flag indicating successfull operation (boolean) 432 @type bool
433 @return flag indicating successfull operation
434 @rtype bool
400 @exception NotImplementedError to indicate that this method must be 435 @exception NotImplementedError to indicate that this method must be
401 implemented by a subclass 436 implemented by a subclass
402 """ 437 """
403 raise NotImplementedError("Not implemented") 438 raise NotImplementedError("Not implemented")
404 439
407 def vcsLogBrowser(self, name, isFile=False): 442 def vcsLogBrowser(self, name, isFile=False):
408 """ 443 """
409 Public method used to view the log of a file/directory in the vcs 444 Public method used to view the log of a file/directory in the vcs
410 with a log browser dialog. 445 with a log browser dialog.
411 446
412 @param name file/directory name to show the log for (string) 447 @param name file/directory name to show the log for
448 @type str
413 @param isFile flag indicating log for a file is to be shown 449 @param isFile flag indicating log for a file is to be shown
414 (boolean) 450 @type bool
415 @exception NotImplementedError to indicate that this method must be 451 @exception NotImplementedError to indicate that this method must be
416 implemented by a subclass 452 implemented by a subclass
417 """ 453 """
418 raise NotImplementedError("Not implemented") 454 raise NotImplementedError("Not implemented")
419 455
420 def vcsDiff(self, name): 456 def vcsDiff(self, name):
421 """ 457 """
422 Public method used to view the diff of a file/directory in the vcs. 458 Public method used to view the diff of a file/directory in the vcs.
423 459
424 @param name file/directory name to be diffed (string) 460 @param name file/directory name to be diffed
461 @type str
425 @exception NotImplementedError to indicate that this method must be 462 @exception NotImplementedError to indicate that this method must be
426 implemented by a subclass 463 implemented by a subclass
427 """ 464 """
428 raise NotImplementedError("Not implemented") 465 raise NotImplementedError("Not implemented")
429 466
445 482
446 def vcsStatus(self, name): 483 def vcsStatus(self, name):
447 """ 484 """
448 Public method used to view the status of a file/directory in the vcs. 485 Public method used to view the status of a file/directory in the vcs.
449 486
450 @param name file/directory name to show the status for (string) 487 @param name file/directory name to show the status for
488 @type str
451 @exception NotImplementedError to indicate that this method must be 489 @exception NotImplementedError to indicate that this method must be
452 implemented by a subclass 490 implemented by a subclass
453 """ 491 """
454 raise NotImplementedError("Not implemented") 492 raise NotImplementedError("Not implemented")
455 493
456 def vcsTag(self, name): 494 def vcsTag(self, name):
457 """ 495 """
458 Public method used to set the tag of a file/directory in the vcs. 496 Public method used to set the tag of a file/directory in the vcs.
459 497
460 @param name file/directory name to be tagged (string) 498 @param name file/directory name to be tagged
499 @type str
461 @exception NotImplementedError to indicate that this method must be 500 @exception NotImplementedError to indicate that this method must be
462 implemented by a subclass 501 implemented by a subclass
463 """ 502 """
464 raise NotImplementedError("Not implemented") 503 raise NotImplementedError("Not implemented")
465 504
492 531
493 def vcsSwitch(self, name): 532 def vcsSwitch(self, name):
494 """ 533 """
495 Public method used to switch a directory to a different tag/branch. 534 Public method used to switch a directory to a different tag/branch.
496 535
497 @param name directory name to be switched (string) 536 @param name directory name to be switched
537 @type str
498 @return flag indicating, that the switch contained an add 538 @return flag indicating, that the switch contained an add
499 or delete (boolean) 539 or delete
540 @rtype bool
500 @exception NotImplementedError to indicate that this method must be 541 @exception NotImplementedError to indicate that this method must be
501 implemented by a subclass 542 implemented by a subclass
502 """ 543 """
503 raise NotImplementedError("Not implemented") 544 raise NotImplementedError("Not implemented")
504 545
506 547
507 def vcsMerge(self, name): 548 def vcsMerge(self, name):
508 """ 549 """
509 Public method used to merge a tag/branch into the local project. 550 Public method used to merge a tag/branch into the local project.
510 551
511 @param name file/directory name to be merged (string) 552 @param name file/directory name to be merged
553 @type str
512 @exception NotImplementedError to indicate that this method must be 554 @exception NotImplementedError to indicate that this method must be
513 implemented by a subclass 555 implemented by a subclass
514 """ 556 """
515 raise NotImplementedError("Not implemented") 557 raise NotImplementedError("Not implemented")
516 558
517 def vcsRegisteredState(self, name): 559 def vcsRegisteredState(self, name):
518 """ 560 """
519 Public method used to get the registered state of a file in the vcs. 561 Public method used to get the registered state of a file in the vcs.
520 562
521 @param name filename to check (string) 563 @param name filename to check
564 @type str
522 @return a combination of canBeCommited and canBeAdded or 565 @return a combination of canBeCommited and canBeAdded or
523 0 in order to signal an error 566 0 in order to signal an error
567 @rtype int
524 @exception NotImplementedError to indicate that this method must be 568 @exception NotImplementedError to indicate that this method must be
525 implemented by a subclass 569 implemented by a subclass
526 """ 570 """
527 raise NotImplementedError("Not implemented") 571 raise NotImplementedError("Not implemented")
528 572
532 """ 576 """
533 Public method used to get the registered states of a number of files 577 Public method used to get the registered states of a number of files
534 in the vcs. 578 in the vcs.
535 579
536 @param names dictionary with all filenames to be checked as keys 580 @param names dictionary with all filenames to be checked as keys
537 @param dname directory to check in (string) 581 @type dict
582 @param dname directory to check in
583 @type str
538 @return the received dictionary completed with a combination of 584 @return the received dictionary completed with a combination of
539 canBeCommited and canBeAdded or None in order to signal an error 585 canBeCommited and canBeAdded or None in order to signal an error
586 @rtype dict
540 @exception NotImplementedError to indicate that this method must be 587 @exception NotImplementedError to indicate that this method must be
541 implemented by a subclass 588 implemented by a subclass
542 """ 589 """
543 raise NotImplementedError("Not implemented") 590 raise NotImplementedError("Not implemented")
544 591
546 593
547 def vcsName(self): 594 def vcsName(self):
548 """ 595 """
549 Public method returning the name of the vcs. 596 Public method returning the name of the vcs.
550 597
551 @return name of the vcs (string) 598 @return name of the vcs
599 @rtype str
552 @exception NotImplementedError to indicate that this method must be 600 @exception NotImplementedError to indicate that this method must be
553 implemented by a subclass 601 implemented by a subclass
554 """ 602 """
555 raise NotImplementedError("Not implemented") 603 raise NotImplementedError("Not implemented")
556 604
558 606
559 def vcsCleanup(self, name): 607 def vcsCleanup(self, name):
560 """ 608 """
561 Public method used to cleanup the local copy. 609 Public method used to cleanup the local copy.
562 610
563 @param name directory name to be cleaned up (string) 611 @param name directory name to be cleaned up
612 @type str
564 @exception NotImplementedError to indicate that this method must be 613 @exception NotImplementedError to indicate that this method must be
565 implemented by a subclass 614 implemented by a subclass
566 """ 615 """
567 raise NotImplementedError("Not implemented") 616 raise NotImplementedError("Not implemented")
568 617
569 def vcsCommandLine(self, name): 618 def vcsCommandLine(self, name):
570 """ 619 """
571 Public method used to execute arbitrary vcs commands. 620 Public method used to execute arbitrary vcs commands.
572 621
573 @param name directory name of the working directory (string) 622 @param name directory name of the working directory
623 @type str
574 @exception NotImplementedError to indicate that this method must be 624 @exception NotImplementedError to indicate that this method must be
575 implemented by a subclass 625 implemented by a subclass
576 """ 626 """
577 raise NotImplementedError("Not implemented") 627 raise NotImplementedError("Not implemented")
578 628
579 def vcsOptionsDialog(self, project, archive, editable=False, parent=None): 629 def vcsOptionsDialog(self, project, archive, editable=False, parent=None):
580 """ 630 """
581 Public method to get a dialog to enter repository info. 631 Public method to get a dialog to enter repository info.
582 632
583 @param project reference to the project object 633 @param project reference to the project object
584 @param archive name of the project in the repository (string) 634 @type Project
635 @param archive name of the project in the repository
636 @type str
585 @param editable flag indicating that the project name is editable 637 @param editable flag indicating that the project name is editable
586 (boolean) 638 @type bool
587 @param parent parent widget (QWidget) 639 @param parent parent widget
640 @type QWidget
588 @exception NotImplementedError to indicate that this method must be 641 @exception NotImplementedError to indicate that this method must be
589 implemented by a subclass 642 implemented by a subclass
590 """ 643 """
591 raise NotImplementedError("Not implemented") 644 raise NotImplementedError("Not implemented")
592 645
593 def vcsNewProjectOptionsDialog(self, parent=None): 646 def vcsNewProjectOptionsDialog(self, parent=None):
594 """ 647 """
595 Public method to get a dialog to enter repository info for getting a 648 Public method to get a dialog to enter repository info for getting a
596 new project. 649 new project.
597 650
598 @param parent parent widget (QWidget) 651 @param parent parent widget
652 @type QWidget
599 @exception NotImplementedError to indicate that this method must be 653 @exception NotImplementedError to indicate that this method must be
600 implemented by a subclass 654 implemented by a subclass
601 """ 655 """
602 raise NotImplementedError("Not implemented") 656 raise NotImplementedError("Not implemented")
603 657
604 def vcsRepositoryInfos(self, ppath): 658 def vcsRepositoryInfos(self, ppath):
605 """ 659 """
606 Public method to retrieve information about the repository. 660 Public method to retrieve information about the repository.
607 661
608 @param ppath local path to get the repository infos (string) 662 @param ppath local path to get the repository infos
609 @return string with ready formated info for display (string) 663 @type str
664 @return string with ready formated info for display
665 @rtype str
610 @exception NotImplementedError to indicate that this method must be 666 @exception NotImplementedError to indicate that this method must be
611 implemented by a subclass 667 implemented by a subclass
612 """ 668 """
613 raise NotImplementedError("Not implemented") 669 raise NotImplementedError("Not implemented")
614 670
618 """ 674 """
619 Public method to instanciate a helper object for the different 675 Public method to instanciate a helper object for the different
620 project browsers. 676 project browsers.
621 677
622 @param browser reference to the project browser object 678 @param browser reference to the project browser object
679 @type ProjectBaseBrowser
623 @param project reference to the project object 680 @param project reference to the project object
681 @type Project
624 @param isTranslationsBrowser flag indicating, the helper is requested 682 @param isTranslationsBrowser flag indicating, the helper is requested
625 for the translations browser (this needs some special treatment) 683 for the translations browser (this needs some special treatment)
684 @type bool
626 @return the project browser helper object 685 @return the project browser helper object
686 @rtype VcsProjectBrowserHelper
627 @exception NotImplementedError to indicate that this method must be 687 @exception NotImplementedError to indicate that this method must be
628 implemented by a subclass 688 implemented by a subclass
629 """ 689 """
630 raise NotImplementedError("Not implemented") 690 raise NotImplementedError("Not implemented")
631 691
634 def vcsGetProjectHelper(self, project): 694 def vcsGetProjectHelper(self, project):
635 """ 695 """
636 Public method to instanciate a helper object for the project. 696 Public method to instanciate a helper object for the project.
637 697
638 @param project reference to the project object 698 @param project reference to the project object
699 @type Project
639 @return the project helper object 700 @return the project helper object
701 @rtype VcsProjectHelper
640 @exception NotImplementedError to indicate that this method must be 702 @exception NotImplementedError to indicate that this method must be
641 implemented by a subclass 703 implemented by a subclass
642 """ 704 """
643 raise NotImplementedError("Not implemented") 705 raise NotImplementedError("Not implemented")
644 706
659 Public method to initialize the VCS configuration. 721 Public method to initialize the VCS configuration.
660 722
661 This method could ensure, that certain files or directories are 723 This method could ensure, that certain files or directories are
662 exclude from being version controlled. 724 exclude from being version controlled.
663 725
664 @param project reference to the project (Project) 726 @param project reference to the project
727 @type Project
665 """ 728 """
666 pass 729 pass
667 730
668 def vcsSupportCommandOptions(self): 731 def vcsSupportCommandOptions(self):
669 """ 732 """
670 Public method to signal the support of user settable command options. 733 Public method to signal the support of user settable command options.
671 734
672 @return flag indicating the support of user settable command options 735 @return flag indicating the support of user settable command options
673 (boolean) 736 @rtype bool
674 """ 737 """
675 return True 738 return True
676 739
677 def vcsSetOptions(self, options): 740 def vcsSetOptions(self, options):
678 """ 741 """
679 Public method used to set the options for the vcs. 742 Public method used to set the options for the vcs.
680 743
681 @param options a dictionary of option strings with keys as 744 @param options a dictionary of option strings with keys as
682 defined by the default options 745 defined by the default options
746 @type dict
683 """ 747 """
684 if self.vcsSupportCommandOptions(): 748 if self.vcsSupportCommandOptions():
685 for key in options: 749 for key in options:
686 with contextlib.suppress(KeyError): 750 with contextlib.suppress(KeyError):
687 self.options[key] = options[key] 751 self.options[key] = options[key]
690 """ 754 """
691 Public method used to retrieve the options of the vcs. 755 Public method used to retrieve the options of the vcs.
692 756
693 @return a dictionary of option strings that can be passed to 757 @return a dictionary of option strings that can be passed to
694 vcsSetOptions. 758 vcsSetOptions.
759 @rtype dict
695 """ 760 """
696 if self.vcsSupportCommandOptions(): 761 if self.vcsSupportCommandOptions():
697 return self.options 762 return self.options
698 else: 763 else:
699 return self.defaultOptions 764 return self.defaultOptions
701 def vcsSetOtherData(self, data): 766 def vcsSetOtherData(self, data):
702 """ 767 """
703 Public method used to set vcs specific data. 768 Public method used to set vcs specific data.
704 769
705 @param data a dictionary of vcs specific data 770 @param data a dictionary of vcs specific data
771 @type dict
706 """ 772 """
707 for key in data: 773 for key in data:
708 with contextlib.suppress(KeyError): 774 with contextlib.suppress(KeyError):
709 self.otherData[key] = data[key] 775 self.otherData[key] = data[key]
710 776
711 def vcsGetOtherData(self): 777 def vcsGetOtherData(self):
712 """ 778 """
713 Public method used to retrieve vcs specific data. 779 Public method used to retrieve vcs specific data.
714 780
715 @return a dictionary of vcs specific data 781 @return a dictionary of vcs specific data
782 @rtype dict
716 """ 783 """
717 return self.otherData 784 return self.otherData
718 785
719 def vcsSetData(self, key, value): 786 def vcsSetData(self, key, value):
720 """ 787 """
721 Public method used to set an entry in the otherData dictionary. 788 Public method used to set an entry in the otherData dictionary.
722 789
723 @param key the key of the data (string) 790 @param key the key of the data
791 @type str
724 @param value the value of the data 792 @param value the value of the data
793 @type Any
725 """ 794 """
726 if key in self.interestingDataKeys: 795 if key in self.interestingDataKeys:
727 self.otherData[key] = value 796 self.otherData[key] = value
728 797
729 def vcsSetDataFromDict(self, dictionary): 798 def vcsSetDataFromDict(self, dictionary):
730 """ 799 """
731 Public method used to set entries in the otherData dictionary. 800 Public method used to set entries in the otherData dictionary.
732 801
733 @param dictionary dictionary to pick entries from 802 @param dictionary dictionary to pick entries from
803 @type dict
734 """ 804 """
735 for key in self.interestingDataKeys: 805 for key in self.interestingDataKeys:
736 if key in dictionary: 806 if key in dictionary:
737 self.otherData[key] = dictionary[key] 807 self.otherData[key] = dictionary[key]
738 808
755 Public method to start a synchroneous process. 825 Public method to start a synchroneous process.
756 826
757 This method starts a process and waits 827 This method starts a process and waits
758 for its end while still serving the Qt event loop. 828 for its end while still serving the Qt event loop.
759 829
760 @param proc process to start (QProcess) 830 @param proc process to start
761 @param program path of the executable to start (string) 831 @type QProcess
762 @param arguments list of arguments for the process (list of strings) 832 @param program path of the executable to start
763 @param workingDir working directory for the process (string) 833 @type str
764 @return flag indicating normal exit (boolean) 834 @param arguments list of arguments for the process
835 @type list of str
836 @param workingDir working directory for the process
837 @type str
838 @return flag indicating normal exit
839 @rtype bool
765 """ 840 """
766 if proc is None: 841 if proc is None:
767 return False 842 return False
768 843
769 if workingDir: 844 if workingDir:
793 868
794 def splitPath(self, name): 869 def splitPath(self, name):
795 """ 870 """
796 Public method splitting name into a directory part and a file part. 871 Public method splitting name into a directory part and a file part.
797 872
798 @param name path name (string) 873 @param name path name
799 @return a tuple of 2 strings (dirname, filename). 874 @type str
875 @return tuple containing the directory name and the file name
876 @rtype tuple of (str, str)
800 """ 877 """
801 if os.path.isdir(name): 878 if os.path.isdir(name):
802 dn = os.path.abspath(name) 879 dn = os.path.abspath(name)
803 fn = "." 880 fn = "."
804 else: 881 else:
808 def splitPathList(self, names): 885 def splitPathList(self, names):
809 """ 886 """
810 Public method splitting the list of names into a common directory part 887 Public method splitting the list of names into a common directory part
811 and a file list. 888 and a file list.
812 889
813 @param names list of paths (list of strings) 890 @param names list of paths
814 @return a tuple of string and list of strings (dirname, filenamelist) 891 @type list of str
892 @return tuple containing the directory name and the file name list
893 @rtype tuple of (str, list of str)
815 """ 894 """
816 dname = os.path.commonprefix(names) 895 dname = os.path.commonprefix(names)
817 if dname: 896 if dname:
818 if not dname.endswith(os.sep): 897 if not dname.endswith(os.sep):
819 dname = os.path.dirname(dname) + os.sep 898 dname = os.path.dirname(dname) + os.sep
826 def addArguments(self, args, argslist): 905 def addArguments(self, args, argslist):
827 """ 906 """
828 Public method to add an argument list to the already present 907 Public method to add an argument list to the already present
829 arguments. 908 arguments.
830 909
831 @param args current arguments list (list of strings) 910 @param args current arguments list
832 @param argslist list of arguments (list of strings) 911 @type list of str
912 @param argslist list of arguments
913 @type list of str
833 """ 914 """
834 for arg in argslist: 915 for arg in argslist:
835 if arg != "": 916 if arg != "":
836 args.append(arg) 917 args.append(arg)
837 918
892 def startStatusMonitor(self, project): 973 def startStatusMonitor(self, project):
893 """ 974 """
894 Public method to start the VCS status monitor thread. 975 Public method to start the VCS status monitor thread.
895 976
896 @param project reference to the project object 977 @param project reference to the project object
897 @return reference to the monitor thread (QThread) 978 @type Project
979 @return reference to the monitor thread
980 @rtype QThread
898 """ 981 """
899 vcsStatusMonitorInterval = ( 982 vcsStatusMonitorInterval = (
900 project.pudata["VCSSTATUSMONITORINTERVAL"] 983 project.pudata["VCSSTATUSMONITORINTERVAL"]
901 if project.pudata["VCSSTATUSMONITORINTERVAL"] 984 if project.pudata["VCSSTATUSMONITORINTERVAL"]
902 else Preferences.getVCS("StatusMonitorInterval") 985 else Preferences.getVCS("StatusMonitorInterval")
958 1041
959 def setStatusMonitorInterval(self, interval, project): 1042 def setStatusMonitorInterval(self, interval, project):
960 """ 1043 """
961 Public method to change the monitor interval. 1044 Public method to change the monitor interval.
962 1045
963 @param interval new interval in seconds (integer) 1046 @param interval new interval in seconds
1047 @type int
964 @param project reference to the project object 1048 @param project reference to the project object
1049 @type Project
965 """ 1050 """
966 if self.statusMonitorThread is not None: 1051 if self.statusMonitorThread is not None:
967 if interval == 0: 1052 if interval == 0:
968 self.stopStatusMonitor() 1053 self.stopStatusMonitor()
969 else: 1054 else:
973 1058
974 def getStatusMonitorInterval(self): 1059 def getStatusMonitorInterval(self):
975 """ 1060 """
976 Public method to get the monitor interval. 1061 Public method to get the monitor interval.
977 1062
978 @return interval in seconds (integer) 1063 @return interval in seconds
1064 @rtype int
979 """ 1065 """
980 if self.statusMonitorThread is not None: 1066 if self.statusMonitorThread is not None:
981 return self.statusMonitorThread.getInterval() 1067 return self.statusMonitorThread.getInterval()
982 else: 1068 else:
983 return 0 1069 return 0
984 1070
985 def setStatusMonitorAutoUpdate(self, auto): 1071 def setStatusMonitorAutoUpdate(self, auto):
986 """ 1072 """
987 Public method to enable the auto update function. 1073 Public method to enable the auto update function.
988 1074
989 @param auto status of the auto update function (boolean) 1075 @param auto status of the auto update function
1076 @type bool
990 """ 1077 """
991 if self.statusMonitorThread is not None: 1078 if self.statusMonitorThread is not None:
992 self.statusMonitorThread.setAutoUpdate(auto) 1079 self.statusMonitorThread.setAutoUpdate(auto)
993 1080
994 def getStatusMonitorAutoUpdate(self): 1081 def getStatusMonitorAutoUpdate(self):
995 """ 1082 """
996 Public method to retrieve the status of the auto update function. 1083 Public method to retrieve the status of the auto update function.
997 1084
998 @return status of the auto update function (boolean) 1085 @return status of the auto update function
1086 @rtype bool
999 """ 1087 """
1000 if self.statusMonitorThread is not None: 1088 if self.statusMonitorThread is not None:
1001 return self.statusMonitorThread.getAutoUpdate() 1089 return self.statusMonitorThread.getAutoUpdate()
1002 else: 1090 else:
1003 return False 1091 return False
1013 1101
1014 def clearStatusMonitorCachedState(self, name): 1102 def clearStatusMonitorCachedState(self, name):
1015 """ 1103 """
1016 Public method to clear the cached VCS state of a file/directory. 1104 Public method to clear the cached VCS state of a file/directory.
1017 1105
1018 @param name name of the entry to be cleared (string) 1106 @param name name of the entry to be cleared
1107 @type str
1019 """ 1108 """
1020 if self.statusMonitorThread is not None: 1109 if self.statusMonitorThread is not None:
1021 self.statusMonitorThread.clearCachedState(name) 1110 self.statusMonitorThread.clearCachedState(name)
1022 1111
1023 def _createStatusMonitorThread(self, interval, project): # noqa: U100 1112 def _createStatusMonitorThread(self, interval, project): # noqa: U100
1027 1116
1028 Note: This method should be overwritten in subclasses in order to 1117 Note: This method should be overwritten in subclasses in order to
1029 support VCS status monitoring. 1118 support VCS status monitoring.
1030 1119
1031 @param interval check interval for the monitor thread in seconds 1120 @param interval check interval for the monitor thread in seconds
1032 (integer) 1121 @type int
1033 @param project reference to the project object 1122 @param project reference to the project object
1034 @return reference to the monitor thread (QThread) 1123 @type Project
1124 @return reference to the monitor thread
1125 @rtype QThread
1035 """ 1126 """
1036 return None # __IGNORE_WARNING_M831__ 1127 return None # __IGNORE_WARNING_M831__

eric ide

mercurial