383 except ValueError: |
383 except ValueError: |
384 self.__lastRev = 0 |
384 self.__lastRev = 0 |
385 |
385 |
386 return itm |
386 return itm |
387 |
387 |
388 def __generateFileItem(self, action, path): |
388 def __generateFileItem(self, action, path, copyfrom): |
389 """ |
389 """ |
390 Private method to generate a changed files tree entry. |
390 Private method to generate a changed files tree entry. |
391 |
391 |
392 @param action indicator for the change action ("A", "D" or "M") |
392 @param action indicator for the change action ("A", "D" or "M") |
393 @param path path of the file in the repository (string) |
393 @param path path of the file in the repository (string) |
|
394 @param copyfrom path the file was copied from (string) |
394 @return reference to the generated item (QTreeWidgetItem) |
395 @return reference to the generated item (QTreeWidgetItem) |
395 """ |
396 """ |
396 itm = QTreeWidgetItem(self.filesTree, [ |
397 itm = QTreeWidgetItem(self.filesTree, [ |
397 self.flags[action], |
398 self.flags[action], |
398 path, |
399 path, |
|
400 copyfrom, |
399 ]) |
401 ]) |
400 |
402 |
401 return itm |
403 return itm |
402 |
404 |
403 def __getLogEntries(self, startRev = None): |
405 def __getLogEntries(self, startRev = None): |
437 args.append('{0}:0'.format(startRev)) |
439 args.append('{0}:0'.format(startRev)) |
438 if not self.projectMode and \ |
440 if not self.projectMode and \ |
439 not self.fname == "." and \ |
441 not self.fname == "." and \ |
440 not self.stopCheckBox.isChecked(): |
442 not self.stopCheckBox.isChecked(): |
441 args.append('--follow') |
443 args.append('--follow') |
442 args.append('--template') |
444 args.append('--copies') |
443 args.append("change|{rev}:{node|short}\n" |
445 args.append('--style') |
444 "user|{author|email}\n" |
446 args.append(os.path.join(os.path.dirname(__file__), "styles", "logBrowser.style")) |
445 "parents|{parents}\n" |
|
446 "date|{date|isodate}\n" |
|
447 "description|{desc}\n" |
|
448 "file_adds|{file_adds}\n" |
|
449 "files_mods|{file_mods}\n" |
|
450 "file_dels|{file_dels}\n" |
|
451 "branches|{branches}\n" |
|
452 "tags|{tags}\n" |
|
453 "@@@\n") |
|
454 if not self.projectMode: |
447 if not self.projectMode: |
455 args.append(self.filename) |
448 args.append(self.filename) |
456 |
449 |
457 self.process.setWorkingDirectory(self.repodir) |
450 self.process.setWorkingDirectory(self.repodir) |
458 |
451 |
551 log["date"] = " ".join(value.strip().split()[:2]) |
545 log["date"] = " ".join(value.strip().split()[:2]) |
552 elif key == "description": |
546 elif key == "description": |
553 log["message"].append(value.strip()) |
547 log["message"].append(value.strip()) |
554 elif key == "file_adds": |
548 elif key == "file_adds": |
555 if value.strip(): |
549 if value.strip(): |
556 for f in value.strip().split(): |
550 for f in value.strip().split(", "): |
557 changedPaths.append({\ |
551 if f in fileCopies: |
558 "action" : "A", |
552 changedPaths.append({ |
559 "path" : f, |
553 "action" : "A", |
560 }) |
554 "path" : f, |
|
555 "copyfrom" : fileCopies[f], |
|
556 }) |
|
557 else: |
|
558 changedPaths.append({ |
|
559 "action" : "A", |
|
560 "path" : f, |
|
561 "copyfrom" : "", |
|
562 }) |
561 elif key == "files_mods": |
563 elif key == "files_mods": |
562 if value.strip(): |
564 if value.strip(): |
563 for f in value.strip().split(): |
565 for f in value.strip().split(", "): |
564 changedPaths.append({\ |
566 changedPaths.append({ |
565 "action" : "M", |
567 "action" : "M", |
566 "path" : f, |
568 "path" : f, |
|
569 "copyfrom" : "", |
567 }) |
570 }) |
568 elif key == "file_dels": |
571 elif key == "file_dels": |
569 if value.strip(): |
572 if value.strip(): |
570 for f in value.strip().split(): |
573 for f in value.strip().split(", "): |
571 changedPaths.append({\ |
574 changedPaths.append({ |
572 "action" : "D", |
575 "action" : "D", |
573 "path" : f, |
576 "path" : f, |
|
577 "copyfrom" : "", |
574 }) |
578 }) |
|
579 elif key == "file_copies": |
|
580 if value.strip(): |
|
581 for entry in value.strip().split(", "): |
|
582 newName, oldName = entry[:-1].split(" (") |
|
583 fileCopies[newName] = oldName |
575 elif key == "branches": |
584 elif key == "branches": |
576 if value.strip(): |
585 if value.strip(): |
577 log["branches"] = value.strip().split() |
586 log["branches"] = value.strip().split(", ") |
578 else: |
587 else: |
579 log["branches"] = ["default"] |
588 log["branches"] = ["default"] |
580 elif key == "tags": |
589 elif key == "tags": |
581 log["tags"] = value.strip().split() |
590 log["tags"] = value.strip().split(", ") |
582 else: |
591 else: |
583 if initialText: |
592 if initialText: |
584 continue |
593 continue |
585 if value.strip(): |
594 if value.strip(): |
586 log["message"].append(value.strip()) |
595 log["message"].append(value.strip()) |
692 |
702 |
693 self.filesTree.clear() |
703 self.filesTree.clear() |
694 changes = current.data(0, self.__changesRole) |
704 changes = current.data(0, self.__changesRole) |
695 if len(changes) > 0: |
705 if len(changes) > 0: |
696 for change in changes: |
706 for change in changes: |
697 self.__generateFileItem(change["action"], change["path"]) |
707 self.__generateFileItem( |
|
708 change["action"], change["path"], change["copyfrom"]) |
698 self.__resizeColumnsFiles() |
709 self.__resizeColumnsFiles() |
699 self.__resortFiles() |
710 self.__resortFiles() |
700 |
711 |
701 self.diffPreviousButton.setEnabled(current is not None) |
712 self.diffPreviousButton.setEnabled(current is not None) |
702 |
713 |