Commit Graph

105 Commits (6181e4f9bf4abfc630e7a5d9d78b0d5a013d263a)
 

Author SHA1 Message Date
James E. Blair 6181e4f9bf Support (most of) gerrit search syntax
Adds a parser that compiles gerrit search queries into sqlalchemy
filters to support the gerrit search syntax both in arbitrary
searches (ctrl-o) as well as dashboards.

Change-Id: Ibc8e5c180b0ca16727938725cfe6380ba7315205
9 years ago
James E. Blair 42419904a8 Add refresh command
Let ctrl-r run a sync all projects task in list views, and sync
the current change in the change view.

Change-Id: I65cfb755bd387b68fe2dbd1562f149adb4421ea1
9 years ago
James E. Blair cff0b0cc9a Fix crash on mouse click in change view
The name of the initial focus method in the hypertext widget
changed from focusItemLeft to focusFirstItem.  This would cause
a crash if the mouse was clicked in the change screen when an
item in the hypertext widget was not already focused.

Change-Id: I046115f43bdd41640ebdaf45198ff3ae4770bb97
9 years ago
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
9 years ago
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
9 years ago
James E. Blair 37cfa0b9bb Make the open change dialog a search
The "Open change" dialog now supports the full search syntax (which
is still just a placeholder).  It is also slightly more robust
about dealing with non-local changes when offline.  The same checks
are now applied to inter-change links.

Change-Id: I3edf6dd66dc95b60eb7507ece813376f08815f80
9 years ago
James E. Blair 141ef95aa9 Add a philosophy note about OpenStackisms
Note that Gertty is for all Gerrits, not just OpenStack's, and so
should not assume any OpenStack-specific configuration.

Change-Id: I3f49c7c6589c136785f7d1d698a6dab16dbf0d35
9 years ago
James E. Blair 6d95ea2dff Genericize the change list and add inter-change links
Make the change list display not only changes for a project, but
any arbitrary set of changes represented by a query.  This will
enable searching, inter-change linking, and custom dashboards.

The search syntax is extremly basic at the moment, but will be
extended to attempt to match the Gerrit webui search syntax as
closely as possible.

Use the new feature to implement a new kind of commentlink that
matches on Iabcdef style change-ids to "search" for matching
changes.

Change-Id: Icbcb166962fd96718ab56eb4118fc5ea43a4ba8b
9 years ago
Robert Collins 2d018c40ff Reuse digest authentication state.
Digest authentication is stateful - a nonce is given by the server and
used for the next request, and the response includes the next nonce
and so forth. By creating a digest state each time we issue a GET /
POST, we were starting that process over leading to a new 401 -
effectively doubling our request counts.

Change-Id: Ib9fc674760f6aec66daf5244c8f0150596ea3ae3
9 years ago
Robert Collins 071c79f6fb Create local refs to prevent pruning
By default git will prune dangling commits more than 2 weeks old. All
the unmerged versions of reviews pushed up more than 2 weeks ago count
as such commits, so we're downloading all the history again and again
each time git-gc --auto ends up being invoked (which is triggered
amongst other things by loose object counts. This leads to random
stalls in gertty when it has to redownload those objects - and this
is obviously worse when offline.

This commit adds refs to prevent this behaviour, but doesn't remove
them at any point. We probably want to facilitate gc of
merged/abandoned/ignored commits at some point. I'm not sure if that
needs to happen in this commit or if it could be added later.

Change-Id: I01c61fd65207fe0dc99208241eefd5d6432c2ad0
9 years ago
Robert Collins 7f0ebb25bd Use a requests.Session object to enable pooling.
Without this a new Session, which has a new PoolManager and thus a
new HTTPS connection pool is used for every single request.

We may have an issue with leaking connections (based on my debug runs
so far) but the default behaviour in that case degrades to unpooled
(new connection made, used, thrown away) so it will be no worse other
than the small overhead of 10 (the default) sockets & SSL session
metadata.

Change-Id: I4b2a4efa414dfc5f8f57b6640ba6796b8a109f58
9 years ago
Robert Collins a9ac0a5664 Fetch all refs for a change at once
This depends on a bug fix in GitPython's 0.3 branch, so crude
backwards compat support has been added until thats in a release.

Change-Id: I03088e372901897b4edcfdb52c6567d2b6626a60
9 years ago
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
9 years ago
Monty Taylor 63a306c241 Remove unneeded bit from setup.cfg
The pbr setup hook is unnecessary.

Change-Id: Iaac62985b9be8e787f855666fc7a93e876022d1c
9 years ago
Monty Taylor e8868cd021 Move contributing section to its own file
For our friends who find things on github, having a file called
CONTRIBUTING.rst is helpful, as it displays as instructions (that
likely no one will read) in the pull request create screen.

Change-Id: Ifcb28600ccc8919a298639c018f6b49eddb7f4ee
9 years ago
Mark McLoughlin abe8078b97 Refactor duplicated code in dependencies handling
Whether we're dealing with depends-on or needed-by, the code is
essentially the same, so let's refactor it.

Change-Id: Ibea8a46059b0da5b23af33236bc53952d90e716e
9 years ago
Jenkins 20dab2fb74 Merge "Add ctrl-o to help dialog" 9 years ago
Jenkins f30288ec66 Merge "Expand the .gitignore file to ignore .egg files" 9 years ago
Jenkins 58dea593fc Merge "Handle multiple child revisions of same parent" 9 years ago
Mark McLoughlin 48f8165e37 Add ctrl-o to help dialog
Change-Id: Iebbe1f6d033651412b4138cd48e7eba6e15ba316
9 years ago
Mark McLoughlin c52bddb693 Handle multiple child revisions of same parent
Where there are multiple revisions of a child change that depend on
the same revision of the parent, we hit this:

    File ".../gertty/view/change.py", line 548, in refreshDependencies
      unseen_keys.remove(c.key)
  KeyError: 177

An example of this a change with this issue is that revision 1 of
I8cd0af9bd4d3669f436f169059e4b602d4d3036c is the parent of revisions 1 and 2
of If608302b6efacceb9ac3630b7ac402cf65ae6d68.

Handle this case by uniqifying the children list simply by using a mapping
of change key to subject.

Change-Id: I934c6df1bdf12bf87cc9e6827d38b92d04057f39
9 years ago
James E. Blair 7a10bfa19b Remove stray debug line
This isn't useful.

Change-Id: I74cc5ff0e0d8bb47d5e3c182edfb9e2df59cf60c
9 years ago
James E. Blair d3768c03e6 Add dependency navigation
Show links to depends-on/needed-by changes.

Change-Id: I77ae6e508b3f1000c8e40ae0ba765ba5caf88705
9 years ago
James E. Blair 95568e32fe Support background sync of missing refs
A recent change added support for synchronously fetching missing
refs for a change, however, if something happened to the git repo
(eg, it was garbage collected or completely removed) then gertty
won't be able to work offline (not to mention will be very slow).

Add db columns to store the fetch locations and a sync job that
will verify that all of the commits gertty needs (for open changes
at least) are on disk, and if not, will fetch them.

Change-Id: If608302b6efacceb9ac3630b7ac402cf65ae6d68
9 years ago
James E. Blair 00d3f6dbfd Add project updated column
This should greatly reduce the number of unecessary sync calls by
storing the last time a gertty queried for changes to a project.
Previously, we used the updated time of the latest change in a
project, however, subsequent queries with that value would typically
return the same change even though it needn't be synced.  Adjusting
that value by a small amount is unlikely to work reliably because
the query is for a relative time and it takes some time to process.
Adjusting for a larger amount (eg, a few seconds) might miss data.
Clock skew is also a concern in this system because we are using
subtracting the server time from the client's time.

By storing the last sync time locally, we can continue to update
it past the highest value that gerrit has, so that we eventually
get queries which return no results.  Clock skew is not an issue
because the delta arithmetic only involves client generated times.
We can also increase the window slightly to account for query
processing time without continuously sync already-synced changes.

Change-Id: I8cd0af9bd4d3669f436f169059e4b602d4d3036c
9 years ago
James E. Blair 77ffdfb550 Handle file-level comments
Change-Id: I3cc371278bddc68b16a5ca3a036012c483f5ef87
Story: 120
9 years ago
James E. Blair b459c93395 Handle missing commits
If gertty is interrupted when fetching commits, or, well, any number
of weird things happen to the git repo, we could end up not having
the needed commits locally.  Do a sanity check before opening a
change and fetch them if needed.

Change-Id: I9bbecd09d1820e405b51a8471c5fd9e4fe8a7841
9 years ago
James E. Blair 101cde8092 Handle (ignore) no-diff renames
If git diff detects a file rename with no changes, it might add
some (currently) unparseable text to the diff.  Ignore it to avoid
an error.

Change-Id: I3542e0dfd9d7c749510f0539066cfa0147e239a3
9 years ago
James E. Blair cb884d8598 Add patchset selection in diff
Change-Id: Ibd544e9619e5c495fe57b4c49eacd585df48f2cf
9 years ago
James E. Blair 349c5b2a62 Correct a problem with tables at very small widths
Gertty would crash if the screen was narrower than the widest column
in a table.  This corrects that.

Change-Id: Ie0a2c6fae16c7c484edb6724fa5dd5f79065e94f
9 years ago
James E. Blair 844634b2f6 Add hyperlinks
Add a 'link' commentlink substitution type that is a hyperlink
which will open the link in the user's web browser.  A built-in
configuration will apply this automaticlly to most http(s)?://
links (using a very simple and not entirely correct regex).

My current commentlink section in my config is as follows:

  commentlinks:
    - match: "^- (?P<job>.*?) (?P<url>.*?) : (?P<result>.*?) (?P<rest>.*)$"
      replacements:
        - link:
            text: "{job:<42}"
            url: "{url}"
        - text:
            color: "test-{result}"
            text: "{result} "
        - text: "{rest}"

In order to support the Zuul commentlink syntax.

Change-Id: Ifceee547c116fdcc15b50a2f73a0ddfe2e98af84
9 years ago
James E. Blair 39890234c3 Re-add alembic to requirements
This got lost in a rebase.

Change-Id: I97bc41114b76e68444dce4cb162cd6f1078d3d4d
9 years ago
James E. Blair 501411fb6c Perform http calls outside of the db session
Since we are enforcing stricter concurrency requirements for sqlite,
we should make sure that the length of time we hold the db lock is
minimal.

Change-Id: Ie69e97667c4a36b4460bab73dcce5f7d423e0640
9 years ago
James E. Blair 1c97e81578 Add custom palettes and commentlinks
Allow the user to modify the palette and create entire custom palettes
in the config file.

Add support for commentlinks, where matching text can be reformatted
and color added.  A future possibility is adding clickable buttons to
the text.  The following snippet in .gertty.yaml will format and colorize
the Zuul messages:

palettes:
  - name: default
    test-SUCCESS: ['light green', '', '']
    test-FAILURE: ['light red', '', '']

commentlinks:
  - match: "^- (?P<job>.*?) (?P<url>.*?) : (?P<result>.*?) (?P<rest>.*)$"
    replacements:
      - text: "{job:<42}"
      - text:
          color: "test-{result}"
          text: "{result} "
      - text: "{rest}"

Change-Id: Ib4644edd42333f2ef252a6318182efeff16ce1e1
9 years ago
James E. Blair 06ef6e54c2 Change config file to YAML
To support commentlinks, palettes, custom dashboards and other
potential future enhancements, we'll need a config file that can
express complex data structures.  Change from configparser to yaml,
adding dependencies on pyyaml and voluptuous for validation.

Change-Id: I670eed0cee1b15aa35d0fa9aea0996603ae08444
9 years ago
James E. Blair 97d99d12f4 Add a project list header
Change-Id: I972fe2a2686d73889120d27a7808d6a57fa78060
9 years ago
James E. Blair ee2df47b95 Add local cherry-pick button
Change-Id: I392b0ce4d672eaf0090018107cc9862f6f95fd50
9 years ago
James E. Blair 7ea4ad8b36 Ensure single-threaded db access
SQLite doesn't really like concurrent access so mediate it with
a lock.

Change-Id: Ibb7aed2a5f028a2a01b61b37fa24f634e4898fbe
9 years ago
James E. Blair a5bb8ec113 Fix closing stacked dialogs
If two dialogs were stacked, when the top one closed we assumed the
top widget would have a title, but it may be another dialog in which
case it does not.

Change-Id: I9353400bf6000bfd106783c157412df150c76d1e
9 years ago
James E. Blair 3252d29400 Add jump to change
Add a dialog that prompts for a change number and syncs that change
if needed then immediately opens the change.

Change-Id: Ic2d4f41ad9bd944c2540e8d71bdd3e730bb96117
9 years ago
Jenkins e63c26f2ed Merge "Add 'killthread'" 9 years ago
Jenkins 62c4c54614 Merge "Change review toggle keybinding to 'v'." 9 years ago
Jenkins 25a5efede6 Merge "Don't show closed changes in the open list" 9 years ago
Monty Taylor 4e1fd36c97 Add alembic to requirements
gertty requires it now but does not declare that.

Also, move pbr to the top of the requirements list. Because of how
python requirements and transitive depends, pbr needs to be listed
first or else hijinks can ensue.

Change-Id: I06c14039501c239d6ead1a66ce8fcfaa7453855c
9 years ago
James E. Blair 9a0eff7b5f Add 'killthread'
The 'k' key will permanently hide a change from most views.  Hidden
changes will continue to show up in the 'all open changes' list, but
not the list of unreviewed changes.

Change-Id: I7fe78c6091c77616339ba73e891434a49bf7df4a
9 years ago
James E. Blair c9f094a62f Change review toggle keybinding to 'v'.
So that the review toggle command can have the same keybinding
in the change list and change view, switch it to 'v'.  'r' and 'd'
are other candidates but both make more sense for the 'review' and
'diff' commands in the change view.

Change-Id: I806fd528cc6fa648450d69181aadbacd67548dda
9 years ago
James E. Blair 4abd095419 Don't show closed changes in the open list
This makes the unreviewed/open change list a little more consistent
but makes it impossible to view closed changes.  We'll add that back
later in another manner, but for now, focus the review task lists
on open changes.

Change-Id: Ide7027e25df40800cde7cba224129f14d2745775
9 years ago
Jenkins 7baa094bfa Merge "Removed closed changes from unreviewed list." 9 years ago
Jenkins 374f0260c6 Merge "Fix handling no newline at EOF in both files" 9 years ago
Jenkins 8578c0e527 Merge "Sync parent changes" 9 years ago