Commit Graph

48 Commits

Author SHA1 Message Date
Jeremy Stanley 559bcfdb33 More skip patchset-level comments in diff view
Starting in Gerrit 3.3, comments can include a special file-id of
/PATCHSET_LEVEL and these comments have no code context, thus no
line numbers or related files. A previous change
I6505d08b62ba7ad8877561a82732889e142873c3 attempted to skip these
when enumerating comments in diff view, but mistakenly only did so
on the new side of the diff. Apply the same skip to the old side as
well.

Change-Id: I22575015bd9e513d00024f026d2248c7a19c3d9e
2021-10-12 19:48:03 +00:00
Jeremy Stanley 699aa18766 Skip patchset-level comments in diff view
Starting in Gerrit 3.3, comments can include a special file-id of
/PATCHSET_LEVEL and these comments have no code context, thus no
line numbers or related files. Skip these when enumerating comments
in diff view because there is no relevant context for them.

Thanks to Paul Fertser for reporting and debugging this problem.

Change-Id: I6505d08b62ba7ad8877561a82732889e142873c3
2021-08-24 09:43:43 -07:00
James E. Blair 73a6481835 Use account_id to identify the user's own account
This is necessary on systems where the username may not be present
(e.g., gerrit-review.googlesource.com).

Change-Id: Ia91b1e9b0fb0f98728dca46a488a92a97a301274
2019-08-28 15:10:19 +02:00
James E. Blair 77f9fa5602 Add prev/next patchset keys to diff view
Add '<' and '>' keybindings which are used for diffing pairs of
patchsets.  '<' moves to the previous pair, '>' to the next.

Change-Id: I46d24f6e62f113e16be2445a8e52384086c01c8e
2019-06-18 09:48:05 -07:00
Doug Wiegley 7892a19cb9
Enable review keys in diffs, and close change on review
- Add a config option to enable closing a change after a review
  is saved, and going back to the change list.
- Enable reviewKeys from the change page to also work on the
  diff view.

Change-Id: I37d907132a012d074d38345f15ef83ec7d9f3e6c
2019-03-06 11:08:23 -07:00
Dominique Martinet f63a381d0b typo - s/fileojb/fileobj/
Change-Id: I0869d9fcd19e74ce30bbb4fef51b710c41150a14
2018-10-05 12:35:35 +09:00
Clint Byrum 158d161cba Py3 compat changes for diff view
With keys being a view we need to convert it to a list explicitly now.

Change-Id: I99b5279d98b6d79bcf6e891040877d7b89bbcf7c
2018-01-22 05:51:23 -08:00
James E. Blair e45faea1b3 Add a short title to diff screen
Change-Id: I78790fcb0eebfec5190e9384f4340301880aaa1b
2016-05-02 11:01:43 -05:00
James E. Blair 1f25c9b450 Make change list searchable
Change-Id: I5edc1a9082dc81dfd06dc00f42abf05f0b03dc26
2016-05-02 11:01:42 -05:00
James E. Blair 7a149db6cf Show potential completions
When entering multi-key commands, display potential completions
in the status bar as a reminder to the user.

Change-Id: I498781576a60789b0f810f08cbc9c8c74d52784f
2016-05-02 11:00:40 -05:00
Cody A.W. Somerville c7ed7ab38a Make 'title' attribute available on dialog widgets
Gertty uses WidgetWraps around the LineBox widget for popup widgets. Add
LineBoxTitlePropertyMixin which adds property and setter for title attribute,
accessing the underlying title_widget on the wrapped LineBox widget.

We use the popup method in the controller to display these dialogs. It uses an
Overlay widget to display our dialog widget on top of the current view. If the
widget to be displayed by the Overlay widget has title attribute, copy it to
the Overlay widget.

Change-Id: I4c6ecbc7ed87867cd67cd93c1125384dd5d4b9af
2016-05-02 10:59:22 -05:00
James E. Blair 37298824ed Correct display of comments at start of file
Due to a math error, comments at the start of the file when outside
of the diff context may have not been displayed.  This corrects
the error.

Change-Id: Ic879d3c434faaa5d884547889a602a7157d1b2a8
2016-01-06 14:18:55 -08:00
James E. Blair 0e80bbf217 Fix multi-key handling in diff view
Change-Id: I032cb04e8d88a5a36ce5125a5bee644e571242c2
2015-12-21 18:02:23 +00:00
James E. Blair 540c8dd7cc Support multiple key input
Change-Id: I0cd0884e0e1f4f0fa82f93e5f7438ff00c5a992a
2015-12-04 13:08:05 -08:00
James E. Blair 6f9e0ceb2f Add help entries for kill, yank, isearch
Change-Id: I13c074a5f67ff9ce3ef5c6819b72507ceadcfd4c
2015-12-04 13:08:05 -08:00
James E. Blair eae2e60084 Add navigation to interactive search
Change-Id: I04de45c7b4c73d1c927d442784614adea7a16381
2015-12-04 13:08:05 -08:00
James E. Blair 0d0f0f6dcd Add interactive search to diff view
Add a simple interactive search to the diff view.  This is bound
to C-s by default.  It highlights text, but does not yet navigate.

Change-Id: Ic795bb5d18911590237b6595f812e10fd4baa1ce
2015-12-04 13:08:05 -08:00
David Stanek 0b16cbb8c4 Refactor: move getRepo out of the App object
The getRepo method really doesn't have much to do with the application
object. Since it's really a utiltiy method for dealing with git repos
I've moved it to gertty.gitrepo.

Change-Id: Ic3349430c456ee184bbf57b6e5b7de4f940b4cc1
2015-06-09 23:50:43 -04:00
James E. Blair 890a0892ef Fix diff display of deleted empty files
This case was not handled at all and caused a crash.

Also handle the case where a file present in the diff is not
present in the new commit while diffing between patchsets.

Change-Id: I24b54b6db7eae8d6c6c349ab6ed2bf846f104f86
2015-05-27 08:38:08 -07:00
James E. Blair c0cabc82f6 Attach comments to files
Since each revision now has files, associate comments with the
file relation rather than revisions so that the path is not stored
twice in the database.

Also correct a problem where comments could be left on empty files
or lines that are not in a file in the unified view.

The SQLAlchemy constraints API seems to have changed between
0.9.9 and 1.0.4.  Support both behaviors to be user-friendly even
though we now specify 1.0.4.

Change-Id: If6593d279a432ea8a48f4bd74a157e4978e69eaa
2015-05-27 08:34:04 -07:00
James E. Blair ddd2088e57 Display file header in top line of diff
To remind the user of the path of the file shown at the top of the
diff, always display the filename there, even after the file header
has scrolled past the top of the screen.

Change-Id: Icf3419647c2ccec45f878fbdc882e3d624eadebb
2015-04-08 15:36:15 -04:00
Jan Kundrát 2028f8f947 Add mouse wheel scrolling
This is implemented by a callout to the widget's existing handler for
key_up and key_down events, and letting the key_* event propagate into
an appropriate place where it's handled as the user's input. Reusing
that handler makes it possible to work in a generic manner, so the code
has no builtin knowledge of the type or layout of the class it's
operating on. The same code is used for project listing, change listing,
single change history view and a diff view as well.

Change-Id: I14600f9dbdf1c066cf5f497f9afcf4e213f03257
2015-03-16 19:30:18 +01:00
James E. Blair 6711e20dc3 Always refresh the screen on pop
When going back a screen, always refresh the screen since something
may have changed while it was not displayed.  Also, refactor the
refresh methods to indicate whether something is of interest so
that if there is more than one refresh triggering event queued, we
still only refresh the screen once (if it is interested).

This should correct the problem where if you review a change and
go back to the change or project listings, the displayed numbers
are incorrect.

Change-Id: I97875831c4bd47f5e38992c38302b47809c785d5
2015-01-07 15:29:52 -08:00
James E. Blair 4aec66f5bb Selectively refresh screen
When sync events produce results that modify the local db state,
record those events and have the screen widgets use that info
to decide whether to refresh (if relevant data are updated).

In practice this should mean far fewer screen refreshes (which
require costly db queries and manifest as UI pauses).

Change-Id: Iefca75ef3d727236b8e4d1199fd4301d25822fef
2014-10-31 11:33:50 -07:00
James E. Blair eb2a491129 Save draft cover messages
DB migration to rename pending -> draft.  Keep pending column on
messages to mean "ready to upload".  Indicate whether messages are
drafts in change display.  Update display of (draft) messages when
their contents change.  Also store draft votes, but don't display
them until finalized (pending upload).  Also remove 'drafts' flag
from revisions if that revision has a pending upload.

Change-Id: Iff427c0c1664351ce8e2d61be2f79f3bfa1f989d
2014-08-31 15:40:31 -07:00
James E. Blair 6815021f3f Add a configurable keymap
Multiple keymaps may be added in either Gertty itself or in config
files, individual keys may be overriden in the standard map, and
the map can be selected via config file or command line option
just as palettes are.

Change the help text to be dynamically generated based on the
current keymap.

Change-Id: I5f8e63897fab3aa14493465256b5d4516cf47dcd
2014-08-29 15:43:25 -07:00
James E. Blair 11bdd67e86 Add unified diff view
Refactor commonalities into base diff view, and implement unified
and side-by-side diff views.  Configurable in the config yaml
file.

Change-Id: Ia8d9241d04f3e7f480618e7efe1d3792f530e173
2014-08-19 10:01:23 -07:00
James E. Blair 473088474c Fix crash on comments from undisplayed files
If there is a comment on a file that would not otherwise be displayed
because there is no diff, create an all-context diff for that file
so the comment may be displayed.

Also, update the number of comment lines to be displayed in the
context expansion button ("Expand X lines of context").

Change-Id: I6db509b42032b282dbbfdbee0d639f97b8b70da3
2014-08-17 10:07:11 -07:00
James E. Blair 9195a05684 Add account table
Also add support for dropping sqlite columns in migrations.

Replace any references to user names with references to account table
entries.

Change-Id: I5a147370f5ee648ddd808f699e80a7778c21d662
2014-08-01 15:49:30 -07:00
James E. Blair 705ca5c766 Add reviewkeys
Reviewkeys are a customizable shortcut for leaving predefined
votes on a change.  For example, if you want to leave a +2
review with no comment, you might simply hit the "meta-2"
key.  The following configuration block is recommended for
use with OpenStack's Gerrit:

  reviewkeys:
    - key: 'meta 0'
      approvals: []
    - key: 'meta 1'
      approvals:
        - category: 'Code-Review'
          value: 1
    - key: 'meta 2'
      approvals:
        - category: 'Code-Review'
          value: 2
    - key: 'meta 3'
      approvals:
        - category: 'Code-Review'
          value: 2
        - category: 'Workflow'
          value: 1

Change-Id: I466024d71d5b1d89fcdc32355e2a9fe13abf5c28
2014-07-12 20:23:56 -07:00
James E. Blair 2fcb7bc219 Add custom dashboards
Use the new generic change list feature to support custom dashboards
based on search queries.

Change-Id: Iea339de591da38bccab54c2e044ef7b94d6789cb
2014-07-12 20:23:54 -07:00
Robert Collins 99aa6ddda3 Support comments in commits
Gerrit represents changes to commits with a file change of /COMMIT_MSG
and magically offset file comments :/. In this patch I reproduce that
logic sufficiently well to match up on all the commits I have looked
at.

Since diffs vs the base should not show the old commit's commit
message, I have hinted to the diff function when to include the commit
message in the output.

Change-Id: I8adb9fa22b384cace88f114f770a3eb5d3a89f5c
2014-07-12 20:23:29 -07:00
James E. Blair 77ffdfb550 Handle file-level comments
Change-Id: I3cc371278bddc68b16a5ca3a036012c483f5ef87
Story: 120
2014-05-30 18:05:01 -07:00
James E. Blair cb884d8598 Add patchset selection in diff
Change-Id: Ibd544e9619e5c495fe57b4c49eacd585df48f2cf
2014-05-30 08:44:22 -07:00
James E. Blair 80cacc5759 Make line numbers dark gray
(Or dark grey.)

Change-Id: Ifee0a0ac9b0931861c9a142d66faf5d0cc00e3e8
2014-05-05 13:46:55 -07:00
James E. Blair 1b9094ab7d Fix comment handling when exiting diff view
Make sure that the revision row is updated with the current comment
count when after leaving the diff view.  Also, don't include draft
comments in the comment count (they are displayed separately).

When exiting the diff view with the esc key while inside of a comment
box, be sure to save that comment before leaving.

Change-Id: I16fe96dc37101d97317b19fdcc38be6729bed551
2014-05-05 13:46:54 -07:00
James E. Blair 29e947f8d6 Standardize on 'focused' in text attrs
Rather than 'selected' or 'reversed' which includes an assumption
about exactly how the text will be displayed.

Change-Id: I91606492494b2f7f7d5028be9e2e8782bb55c5a5
2014-05-05 13:46:54 -07:00
James E. Blair ac295192e0 Colorize some buttons
Change-Id: I76c1bc22b5f0edb5064ce69428f94a2084aa9d7f
2014-05-05 13:46:47 -07:00
James E. Blair 5657a6d340 Add buttons to expand hidden context in diff
Change-Id: I5787a74cf5a31e512ef2649ea273fd0355009465
2014-05-05 10:24:00 -07:00
James E. Blair 227b6a0add Expand context as needed to include all comments
Use methods that can be re-used to support manually expanding
context by the user.

Also fix a s/old/new/ typo bug.

Change-Id: I5b247204b959add9fbfd51af7e508d3d07b7c001
2014-05-04 13:32:28 -07:00
James E. Blair 067aa68dcd Process more diff output
This gets up to 10,000 lines of diff context information, but does
not display it.  Now we have the data and in a future change can
display more context if needed in order to show comments or if the
user requests it.

Change-Id: Id569732ffa40610f67bf479de8bf936580fbacf1
2014-05-03 17:42:37 -07:00
James E. Blair a44a82bff3 Refactor diff calculation to facilitate more context
Create groups of diff chunks and context chunks.  In a subsequent
change we can use that to better control the displayed context.

Change-Id: I75858d002e9a9fff809c91cfced81c6022d86196
2014-05-03 16:51:30 -07:00
Joshua Harlow 7a71108c60 Add a pbr compatible setup
Add a setup.cfg and setup.py and fill in those files
so that gertty can be installed easily.

Adjust gertty.py to have a main function that
can be referenced as a console entrypoint during
installation.

Also adjusted a bunch of imports that were failing after
installation occurred (but now they should not fail since they
correctly reference the gertty module namespace).

Change-Id: I532ced51583b26300ba9a2efb97f8e41bc69ec8d
2014-05-03 11:54:49 -07:00
James E. Blair 68c51ffdb7 Add a Quit dialog
Remove the contextlib pipe close feature -- file descriptors are
closed on program exit anyway.  Letting that happen normally
actually makes exiting with CTRL-C nicer (fewer race conditions).

Map "CTRL-Q" to the quit command, but pop up a yes/no dialog.

Refactor the MessageDialog into a ButtonDialog base class that
can serve MessageDialog and YesNoDialog.

Add global help text that is prepended to each screen's help text
to deal with the growing number of global commands.

Change-Id: I455344cb20fb19032a3964d602fc886e19f256e5
2014-05-02 19:43:07 -07:00
James E. Blair f15feec7bf Fix editing inline comments
An earlier change broke editing comments.

Change-Id: I7c10d29088bf15145c864843529c243c7c0c1169
2014-04-30 09:21:33 -07:00
James E. Blair d924789cf9 Fix some diff comment display errors
Change-Id: I0106e302feb6d3c02faa3fa7b6faf7907e833d5f
2014-04-29 20:22:14 -07:00
James E. Blair 5585ba6786 Fix displaying new files
Change-Id: Idacb212482b33574ba71bf8f90b62b594616b77a
Closes-Task: some subtask of story 70
2014-04-29 18:19:36 -07:00
James E. Blair 1d6b0fd881 Initial commit
Change-Id: Ie79f257c46a2c50abdd7ce63bfeceaad976ca878
2014-04-29 16:28:49 -07:00