60 BookmarksColumn = 8 |
60 BookmarksColumn = 8 |
61 |
61 |
62 LargefilesCacheL = ".hglf/" |
62 LargefilesCacheL = ".hglf/" |
63 LargefilesCacheW = ".hglf\\" |
63 LargefilesCacheW = ".hglf\\" |
64 PathSeparatorRe = re.compile(r"/|\\") |
64 PathSeparatorRe = re.compile(r"/|\\") |
|
65 |
|
66 GraftedRe = re.compile(r"\(grafted from ([0-9a-fA-F]+)\)") |
|
67 GraftedTemplate = '(grafted from <a href="chg:{0}">{0}</a>)' |
65 |
68 |
66 ClosedIndicator = " \u2612" |
69 ClosedIndicator = " \u2612" |
67 |
70 |
68 def __init__(self, vcs, mode="", parent=None): |
71 def __init__(self, vcs, mode="", parent=None): |
69 """ |
72 """ |
1656 childrenStr = self.__childrenTemplate.format( |
1659 childrenStr = self.__childrenTemplate.format( |
1657 ", ".join(childLinks)) |
1660 ", ".join(childLinks)) |
1658 else: |
1661 else: |
1659 childrenStr = "" |
1662 childrenStr = "" |
1660 |
1663 |
1661 messageStr = "<br />\n".join([ |
1664 messagesList = [] |
1662 Utilities.html_encode(line.strip()) |
1665 for line in itm.data(0, self.__messageRole): |
1663 for line in itm.data(0, self.__messageRole) |
1666 match = HgLogBrowserDialog.GraftedRe.fullmatch(line) |
1664 ]) |
1667 if match: |
|
1668 messagesList.append( |
|
1669 HgLogBrowserDialog.GraftedTemplate.format( |
|
1670 match.group(1))) |
|
1671 else: |
|
1672 messagesList.append(Utilities.html_encode(line.strip())) |
|
1673 messageStr = "<br />\n".join(messagesList) |
1665 |
1674 |
1666 html = self.__detailsTemplate.format( |
1675 html = self.__detailsTemplate.format( |
1667 itm.text(self.RevisionColumn), |
1676 itm.text(self.RevisionColumn), |
1668 itm.text(self.DateColumn), |
1677 itm.text(self.DateColumn), |
1669 itm.text(self.AuthorColumn), |
1678 itm.text(self.AuthorColumn), |
2462 details pane. |
2471 details pane. |
2463 |
2472 |
2464 @param url URL that was clicked |
2473 @param url URL that was clicked |
2465 @type QUrl |
2474 @type QUrl |
2466 """ |
2475 """ |
2467 if url.scheme() == "rev": |
2476 if url.scheme() in ("rev", "chg"): |
2468 # a parent or child revision was clicked, show the respective item |
2477 if url.scheme() == "rev": |
2469 rev = url.path() |
2478 # a parent or child revision was clicked, show the item |
2470 searchStr = "{0:>7}:".format(rev) |
2479 rev = url.path() |
2471 # format must be in sync with item generation format |
2480 searchStr = "{0:>7}:".format(rev) |
|
2481 # format must be in sync with item generation format |
|
2482 searchFlags = Qt.MatchFlag.MatchStartsWith |
|
2483 elif url.scheme() == "chg": |
|
2484 # a changeset hash was clicked, show the item |
|
2485 changeset = url.path() |
|
2486 searchStr = ":{0}".format(changeset[:12]) # max. 12 hash chars |
|
2487 # format must be in sync with item generation format |
|
2488 searchFlags = Qt.MatchFlag.MatchContains |
2472 items = self.logTree.findItems( |
2489 items = self.logTree.findItems( |
2473 searchStr, Qt.MatchFlag.MatchStartsWith, self.RevisionColumn) |
2490 searchStr, searchFlags, self.RevisionColumn) |
2474 if items: |
2491 if items: |
2475 itm = items[0] |
2492 itm = items[0] |
2476 if itm.isHidden(): |
2493 if itm.isHidden(): |
2477 itm.setHidden(False) |
2494 itm.setHidden(False) |
2478 self.logTree.setCurrentItem(itm) |
2495 self.logTree.setCurrentItem(itm) |
2479 else: |
2496 else: |
2480 # load the next batch and try again |
2497 # load the next batch and try again |
2481 if self.nextButton.isEnabled(): |
2498 if not self.cancelled and self.nextButton.isEnabled(): |
2482 self.__addFinishCallback( |
2499 self.__addFinishCallback( |
2483 lambda: self.__revisionClicked(url)) |
2500 lambda: self.__revisionClicked(url)) |
2484 self.on_nextButton_clicked() |
2501 self.on_nextButton_clicked() |
2485 |
2502 |
2486 ########################################################################### |
2503 ########################################################################### |