Show More
@@ -77,7 +77,6 b' class patchnode(object):' | |||
|
77 | 77 | Return the closest next item of the same type where there are no items |
|
78 | 78 | of different types between the current item and this closest item. |
|
79 | 79 | If no such item exists, return None. |
|
80 | ||
|
81 | 80 | """ |
|
82 | 81 | raise NotImplementedError("method must be implemented by subclass") |
|
83 | 82 | |
@@ -86,7 +85,6 b' class patchnode(object):' | |||
|
86 | 85 | Return the closest previous item of the same type where there are no |
|
87 | 86 | items of different types between the current item and this closest item. |
|
88 | 87 | If no such item exists, return None. |
|
89 | ||
|
90 | 88 | """ |
|
91 | 89 | raise NotImplementedError("method must be implemented by subclass") |
|
92 | 90 | |
@@ -109,7 +107,6 b' class patchnode(object):' | |||
|
109 | 107 | the next item. |
|
110 | 108 | |
|
111 | 109 | If it is not possible to get the next item, return None. |
|
112 | ||
|
113 | 110 | """ |
|
114 | 111 | try: |
|
115 | 112 | itemfolded = self.folded |
@@ -163,7 +160,6 b' class patchnode(object):' | |||
|
163 | 160 | next item. |
|
164 | 161 | |
|
165 | 162 | If it is not possible to get the previous item, return None. |
|
166 | ||
|
167 | 163 | """ |
|
168 | 164 | if constrainlevel: |
|
169 | 165 | return self.prevsibling() |
@@ -190,7 +186,6 b' class patchnode(object):' | |||
|
190 | 186 | class patch(patchnode, list): # todo: rename patchroot |
|
191 | 187 | """ |
|
192 | 188 | list of header objects representing the patch. |
|
193 | ||
|
194 | 189 | """ |
|
195 | 190 | def __init__(self, headerlist): |
|
196 | 191 | self.extend(headerlist) |
@@ -487,7 +482,6 b' def gethw():' | |||
|
487 | 482 | this is a rip-off of a rip-off - taken from the bpython code. it is |
|
488 | 483 | useful / necessary because otherwise curses.initscr() must be called, |
|
489 | 484 | which can leave the terminal in a nasty state after exiting. |
|
490 | ||
|
491 | 485 | """ |
|
492 | 486 | h, w = struct.unpack( |
|
493 | 487 | "hhhh", fcntl.ioctl(_origstdout, termios.TIOCGWINSZ, "\000"*8))[0:2] |
@@ -497,7 +491,6 b' def chunkselector(ui, headerlist):' | |||
|
497 | 491 | """ |
|
498 | 492 | curses interface to get selection of chunks, and mark the applied flags |
|
499 | 493 | of the chosen chunks. |
|
500 | ||
|
501 | 494 | """ |
|
502 | 495 | ui.write(_('starting interactive selection\n')) |
|
503 | 496 | chunkselector = curseschunkselector(headerlist, ui) |
@@ -518,7 +511,6 b' def testchunkselector(testfn, ui, header' | |||
|
518 | 511 | """ |
|
519 | 512 | test interface to get selection of chunks, and mark the applied flags |
|
520 | 513 | of the chosen chunks. |
|
521 | ||
|
522 | 514 | """ |
|
523 | 515 | chunkselector = curseschunkselector(headerlist, ui) |
|
524 | 516 | if testfn and os.path.exists(testfn): |
@@ -595,7 +587,6 b' class curseschunkselector(object):' | |||
|
595 | 587 | |
|
596 | 588 | if the currently selected item is already at the top of the screen, |
|
597 | 589 | scroll the screen down to show the new-selected item. |
|
598 | ||
|
599 | 590 | """ |
|
600 | 591 | currentitem = self.currentselecteditem |
|
601 | 592 | |
@@ -616,7 +607,6 b' class curseschunkselector(object):' | |||
|
616 | 607 | |
|
617 | 608 | if the currently selected item is already at the top of the screen, |
|
618 | 609 | scroll the screen down to show the new-selected item. |
|
619 | ||
|
620 | 610 | """ |
|
621 | 611 | currentitem = self.currentselecteditem |
|
622 | 612 | nextitem = currentitem.previtem() |
@@ -640,7 +630,6 b' class curseschunkselector(object):' | |||
|
640 | 630 | |
|
641 | 631 | if the currently selected item is already at the bottom of the screen, |
|
642 | 632 | scroll the screen up to show the new-selected item. |
|
643 | ||
|
644 | 633 | """ |
|
645 | 634 | #self.startprintline += 1 #debug |
|
646 | 635 | currentitem = self.currentselecteditem |
@@ -657,7 +646,6 b' class curseschunkselector(object):' | |||
|
657 | 646 | if the cursor is already at the bottom chunk, scroll the screen up and |
|
658 | 647 | move the cursor-position to the subsequent chunk. otherwise, only move |
|
659 | 648 | the cursor position down one chunk. |
|
660 | ||
|
661 | 649 | """ |
|
662 | 650 | # todo: update docstring |
|
663 | 651 | |
@@ -680,7 +668,6 b' class curseschunkselector(object):' | |||
|
680 | 668 | def rightarrowevent(self): |
|
681 | 669 | """ |
|
682 | 670 | select (if possible) the first of this item's child-items. |
|
683 | ||
|
684 | 671 | """ |
|
685 | 672 | currentitem = self.currentselecteditem |
|
686 | 673 | nextitem = currentitem.firstchild() |
@@ -700,7 +687,6 b' class curseschunkselector(object):' | |||
|
700 | 687 | if the current item can be folded (i.e. it is an unfolded header or |
|
701 | 688 | hunk), then fold it. otherwise try select (if possible) the parent |
|
702 | 689 | of this item. |
|
703 | ||
|
704 | 690 | """ |
|
705 | 691 | currentitem = self.currentselecteditem |
|
706 | 692 | |
@@ -725,7 +711,6 b' class curseschunkselector(object):' | |||
|
725 | 711 | """ |
|
726 | 712 | select the header of the current item (or fold current item if the |
|
727 | 713 | current item is already a header). |
|
728 | ||
|
729 | 714 | """ |
|
730 | 715 | currentitem = self.currentselecteditem |
|
731 | 716 | |
@@ -775,7 +760,6 b' class curseschunkselector(object):' | |||
|
775 | 760 | """ |
|
776 | 761 | toggle the applied flag of the specified item. if no item is specified, |
|
777 | 762 | toggle the flag of the currently selected item. |
|
778 | ||
|
779 | 763 | """ |
|
780 | 764 | if item is None: |
|
781 | 765 | item = self.currentselecteditem |
@@ -898,7 +882,6 b' class curseschunkselector(object):' | |||
|
898 | 882 | the screen in the x direction. the current cursor position is |
|
899 | 883 | taken into account when making this calculation. the string can span |
|
900 | 884 | multiple lines. |
|
901 | ||
|
902 | 885 | """ |
|
903 | 886 | y, xstart = window.getyx() |
|
904 | 887 | width = self.xscreensize |
@@ -927,7 +910,6 b' class curseschunkselector(object):' | |||
|
927 | 910 | the string stretches to the right border of the window. |
|
928 | 911 | |
|
929 | 912 | if showwhtspc == True, trailing whitespace of a string is highlighted. |
|
930 | ||
|
931 | 913 | """ |
|
932 | 914 | # preprocess the text, converting tabs to spaces |
|
933 | 915 | text = text.expandtabs(4) |
@@ -1042,8 +1024,8 b' class curseschunkselector(object):' | |||
|
1042 | 1024 | """ |
|
1043 | 1025 | create a string to prefix a line with which indicates whether 'item' |
|
1044 | 1026 | is applied and/or folded. |
|
1027 | """ | |
|
1045 | 1028 | |
|
1046 | """ | |
|
1047 | 1029 | # create checkbox string |
|
1048 | 1030 | if item.applied: |
|
1049 | 1031 | if not isinstance(item, uihunkline) and item.partial: |
@@ -1076,8 +1058,8 b' class curseschunkselector(object):' | |||
|
1076 | 1058 | """ |
|
1077 | 1059 | print the header to the pad. if countlines is True, don't print |
|
1078 | 1060 | anything, but just count the number of lines which would be printed. |
|
1061 | """ | |
|
1079 | 1062 | |
|
1080 | """ | |
|
1081 | 1063 | outstr = "" |
|
1082 | 1064 | text = header.prettystr() |
|
1083 | 1065 | chunkindex = self.chunklist.index(header) |
@@ -1192,6 +1174,7 b' class curseschunkselector(object):' | |||
|
1192 | 1174 | if item is not specified, then print the entire patch. |
|
1193 | 1175 | (hiding folded elements, etc. -- see __printitem() docstring) |
|
1194 | 1176 | """ |
|
1177 | ||
|
1195 | 1178 | if item is None: |
|
1196 | 1179 | item = self.headerlist |
|
1197 | 1180 | if recursechildren: |
@@ -1233,8 +1216,8 b' class curseschunkselector(object):' | |||
|
1233 | 1216 | |
|
1234 | 1217 | if recursechildren is False, then only print the item without its |
|
1235 | 1218 | child items. |
|
1219 | """ | |
|
1236 | 1220 | |
|
1237 | """ | |
|
1238 | 1221 | if towin and self.outofdisplayedarea(): |
|
1239 | 1222 | return |
|
1240 | 1223 | |
@@ -1281,8 +1264,8 b' class curseschunkselector(object):' | |||
|
1281 | 1264 | if no item is given, assume the entire patch. |
|
1282 | 1265 | if ignorefolding is True, folded items will be unfolded when counting |
|
1283 | 1266 | the number of lines. |
|
1267 | """ | |
|
1284 | 1268 | |
|
1285 | """ | |
|
1286 | 1269 | # temporarily disable printing to windows by printstring |
|
1287 | 1270 | patchdisplaystring = self.printitem(item, ignorefolding, |
|
1288 | 1271 | recursechildren, towin=False) |
@@ -1316,8 +1299,8 b' class curseschunkselector(object):' | |||
|
1316 | 1299 | attrlist is used to 'flavor' the returned color-pair. this information |
|
1317 | 1300 | is not stored in self.colorpairs. it contains attribute values like |
|
1318 | 1301 | curses.A_BOLD. |
|
1302 | """ | |
|
1319 | 1303 | |
|
1320 | """ | |
|
1321 | 1304 | if (name is not None) and name in self.colorpairnames: |
|
1322 | 1305 | # then get the associated color pair and return it |
|
1323 | 1306 | colorpair = self.colorpairnames[name] |
@@ -1448,8 +1431,8 b' are you sure you want to review/edit and' | |||
|
1448 | 1431 | When the amend flag is set, a commit will modify the most recently |
|
1449 | 1432 | committed changeset, instead of creating a new changeset. Otherwise, a |
|
1450 | 1433 | new changeset will be created (the normal commit behavior). |
|
1434 | """ | |
|
1451 | 1435 | |
|
1452 | """ | |
|
1453 | 1436 | try: |
|
1454 | 1437 | ver = float(util.version()[:3]) |
|
1455 | 1438 | except ValueError: |
@@ -1641,8 +1624,8 b' are you sure you want to review/edit and' | |||
|
1641 | 1624 | def main(self, stdscr): |
|
1642 | 1625 | """ |
|
1643 | 1626 | method to be wrapped by curses.wrapper() for selecting chunks. |
|
1627 | """ | |
|
1644 | 1628 | |
|
1645 | """ | |
|
1646 | 1629 | signal.signal(signal.SIGWINCH, self.sigwinchhandler) |
|
1647 | 1630 | self.stdscr = stdscr |
|
1648 | 1631 | # error during initialization, cannot be printed in the curses |
General Comments 0
You need to be logged in to leave comments.
Login now