282 Commits

Author SHA1 Message Date
Miguel Grinberg
497fd3f358 Add change list options to configuration
This change adds default sorting options for the change list to the
configuration file.

Change-Id: I5a20b1be359535e91b015a40bdedc1fc30e8ac0d
2015-03-24 10:10:27 +11:00
Paul Belanger
abfe8013bc Add missing requirement for six
This is needed in dbsupport.py.

Change-Id: I51e7cf9d344e64c267cdc4cedddb6c26f0b8b5a4
Signed-off-by: Paul Belanger <paul.belanger@polybeacon.com>
2015-03-20 09:25:08 -04:00
James E. Blair
efe8774bb7 Switch "Updated" column to fixed width
Since we're using iso format dates, we know it should be at most
10 chars wide.  Set the width to 10 to avoid wrapping on small
screens.

Change-Id: I854cde22cb1d7678834c4d2ccf423c859b895770
2015-03-12 07:41:55 -07:00
James E. Blair
eafe3d599c Don't display project column in project change list
4aec66f5bb3126359c15bd37eeced60536540856 introduced a regression
where the project column is always displayed in a change list.  It
is redundant when listing changes for a single project.  This
fixes the regression.

Change-Id: I3ab9aa9cac0243b1027a1339e5fe55cd83f9ad3a
2015-03-12 07:26:19 -07:00
James E. Blair
9d99e078f1 Display times in local tz
By default, display times using the local timezone.  Add timezone
info to time displays where space permits.  Add an option to restore
the current behavior where times are displayed in UTC.

Change-Id: I6035b6277dc49774537a762b2946c56a3b8dec17
Co-Authored-By: Bradley Jones <jones.bradley@me.com>
2015-03-11 09:42:03 -07:00
James E. Blair
c5f7246717 Add a 30 second timeout for requests
After 30 seconds of inactivity from the server, the request will
be aborted and Gertty will switch to offline mode.

Change-Id: I32d65ad07f54e4624eaf826d35a5a19c5a88e6ac
2015-03-11 09:42:01 -07:00
James E. Blair
712f83fbfa Upgrade to requests 2.5.3
Recent requests were leaking this exception from its vendored copy
of urllib3:

  ProtocolError: ('Connection aborted.', error(101, 'Network is unreachable'))

Update to a version where this is fixed so that we can correctly
detect that and switch to offline mode.

Change-Id: I28a223c0c4a4dd1f9c073e0ddf07985ff52386b2
2015-03-11 09:41:57 -07:00
James E. Blair
d7555e3263 Only sync parent commit once
When a revision's parent commit is not known locally, it is added
to the sync queue.  However, if multiple revisions of a change have
the same parent (which is common) a sync task will be added for
each copy.  Instead, keep track of the parents of each revision
of a change and only sync each such commit once.

Change-Id: Ibe8fc80d87b338b6da9d529b1be38c7c4efb65f4
2015-03-11 09:41:47 -07:00
James E. Blair
461a0eee45 Add indexes to revision table
The commit and parent columns were not indexed, meaning that checking to see
if a commit's parent needed to be synced incurred a full table scan.  Add
indexes so it's faster.

Change-Id: I093f8265a655a1fe2b7ba1be792b87e6d701fec1
2015-03-10 16:32:59 -07:00
James E. Blair
db9b6407b6 Hide webbrowser output
On my terminal, opening a web browser link always produces the output
"GLib-CRITICAL **: g_slice_set_config: assertion `sys_page_size == 0' failed"

This is apparently a bug in mozilla:

https://bugzilla.mozilla.org/show_bug.cgi?id=833117

However, the python webbrowser module could mask it by redirecting outputs.
In fact, it does so for some types of browsers, but apparently not xdg-open.
Create a new webbrowser subclass that redirects output and register it as
the appropriate way to use xdg-open so that the message is hidden.

Change-Id: I018673a2773a3bc21d7d7c1facccba91eafe1174
2015-03-10 09:54:06 -07:00
James E. Blair
b10441866a Fix searching with uppercase booleans
AND and OR caused a syntax error while 'and' and 'or' worked.

The debugging method at the bottom of __init__.py is intentional,
at least until there's real testing for this.

Change-Id: Ib5a5d7b47d64204f6dda36513dea8249d3bbce4e
2015-03-06 16:50:00 -08:00
James E. Blair
a8422949ac Fix keymap substitution
We were only performing the '-' -> ' ' substitution needed for
keymap names when updating urwid commands.  Do that for all commands.

Change-Id: I2bae39523993da12848c818e6caef259d9f9fa4a
2015-03-05 07:59:05 -08:00
James E. Blair
3750ccdf42 Wrap long lines in side-by-side diffs
This was already the case for unified diffs.

Change-Id: I24cf40f1afe23bf71d1a4effb90417499158b134
2015-03-03 10:02:21 -08:00
James E. Blair
ac492e1580 Fix crashing on files with no changes
If a file only has mode differences, but no content difference,
we do not have access through GitPython to find out the filenames.

https://github.com/gitpython-developers/GitPython/pull/266 has
been submitted to correct that, but in the mean time, display
"Unknown File" to avoid crashing.

Change-Id: Ic935f9737ae3978a7a639408c24f166c76a2c999
Story: 2000027
2015-03-02 09:39:19 -08:00
James E. Blair
121df156cd Fix syncing messages attached to draft revisions
If a revision is a draft, we will not be able to sync it.  Strangely,
the Gerrit API will still return review messages attached to that
draft (including "Foo uploaded patch set 1").  The gerrit webui doesn't
display those, so let's not bother storing/displaying them either.
The current code crashes when trying to save the message because the
revision doesn't exist.

Change-Id: I51617249c7240b199f0104c66b136922e36d6b7f
Story: 2000155
2015-03-02 08:03:57 -08:00
Jay Pipes
76ad79278b Add some INFO level log messages
Adds INFO level log message for successful atomic units of work in the
Sync tasks.

Change-Id: I4c5a69a1ad124d7a75e2f1843f23fd1d0d9cb7e9
2015-02-27 15:01:32 -08:00
Jay Pipes
823c587a12 Add INFO log level potential with --verbose flag
Simply adds a new -v/--verbose CLI option which configures logging at
the INFO log level. Also changes the debug logging in sync.get() to log
a non-200 HTTP return code, which fixes the Storyboard story 2000084,
where a ValueError was being raised by trying to JSON-decode a non-200
response body.

Change-Id: Ieabc606e0570ddf3d3af67bb926cad79b0e87591
Closes-story: 2000084
2015-02-27 15:01:14 -08:00
Jay Pipes
259008cea5 Speed up the toggling of reviewed/hidden changes
When in the list changes view, if you typed 'v' or 'k' to mark a change
reviewed or hidden, a full refresh of the list view's contents,
including querying the database for all new records, would occur. For
the cases when we're in the Unreviewed changes list, toggling a change
to reviewed should simply remove that change from the listbox, to avoid
doing a full refresh. Same for the hidden toggle.

Storyboard story: 2000085

Change-Id: I76bb439cd5ce386da7d160d3160f36c769a2a99f
2015-02-27 15:01:12 -08:00
Jay Pipes
77f980b70e Release DB session thread lock earlier in syncs
For some of the sync tasks, the DB session context manager was holding
the Database object's thread lock for longer periods of time than was
necessary. This patch changes the sessionmaker in the Database object to
not expire objects on commit and not autoflush the session. This allows
the objects returned by a DB query to be used without running into an
UnboundExecutionError when trying to access attributes on the SQLAlchemy
models returned from a query after the session.commit() has been called.

We then modify some of the sync tasks to grab records and release the
thread lock on the DB session and then do their processing work instead
of holding the lock for the duration of the processing work.

Storyboard story: 2000086

Change-Id: Iae6d789409b88f4e3cb35ac9e4f839f8e4d79a97
2015-02-27 15:01:04 -08:00
Jenkins
cd9c164c6e Merge "Security: Require config file to be mode 0600" 2015-02-27 00:10:49 +00:00
Jenkins
e477a9f9df Merge "Disable InsecureRequestWarning" 2015-02-27 00:07:47 +00:00
Jenkins
8971fcc965 Merge "Fix reversing changes" 2015-02-27 00:07:12 +00:00
Jenkins
fff394cee6 Merge "Set priority of initial change sync to normal" 2015-02-27 00:07:06 +00:00
Jenkins
b9406696bd Merge "Add support for starred changes" 2015-02-27 00:06:53 +00:00
John L. Villalovos
93052d1c68 Security: Require config file to be mode 0600
Require the config file to have a permission of 0600 if it contains a
password.  This way it is only readable/writeable by the user

Change-Id: I0c38a3c41125422b981ed3f799870906a0700180
2015-02-24 16:30:13 -08:00
Jenkins
14d7aee065 Merge "Add detailed examples and dashboards a la gerrit" 2015-02-24 22:07:08 +00:00
James Polley
119011081e Add detailed examples and dashboards a la gerrit
Add some more detailed notes on creating per-project filters, as the
syntax is a little different from that used directly on Gerrit.

Add a second "Incoming reviews" dashboard, to match what Gerrit has.

Change-Id: I77377a14bc78ce2e932e3e1c2348766a84eb9911
2015-02-20 15:03:17 -08:00
Khai Do
65aec10f1c Disable InsecureRequestWarning
When using gertty with SSL certificate validation turned off the
InsecureRequestWarning is shown on the screen on every REST
request (http://imgur.com/i18F1iO) which renders gertty pretty
useless.  This changes disables the warnings when SSL certificate
validation is disabled.

Change-Id: Id6f46e85168bba599f8380b6613d8835d65661c3
2015-02-18 21:32:58 -08:00
James E. Blair
e89f5d7818 Fix reversing changes
The threading change broke reversing changes because the reversing
code used an iterator and the threading code expected a list.  We
don't need to keep a copy of the original, so just modify the list
in place when reversing, so we end up with a list in both cases.

Change-Id: I577546b09f35829c4a91e7f2922f21ed26b50a1c
2015-02-13 07:12:34 -08:00
James E. Blair
5a4ee52ab5 Set priority of initial change sync to normal
On startup, the initial update of all projects was set to high
priority.  That makes sense for most of the sync tasks at startup
(upload changes, etc).  But if you have left gertty to not sync
for any period of time, there could be quite a changes to sync.
With that happening at high priority, there is no way to find
a change and individually refresh it.  So move the initial sync
to low priority.  (Further syncs of all projects are at low
priority.)

Change-Id: I7cdffc39048ac4770bffefebe32d08371feb11be
2015-02-13 07:04:20 -08:00
James E. Blair
5dffc27d16 Add support for starred changes
Change-Id: I2d57f0471f009e5e38d3652dbe3b0d9ac8854d7c
2015-02-13 07:04:18 -08:00
James E. Blair
ac0c988603 Fix approval sync
We're treating some fields in the db as if they have a unique
constraint, but there is no actual unique constraint in the db.
If, somehow, we ended up with multiple approvals for the same
user associated with a change, then the correct values may not
be displayed in the change approval table.

Correct this by detecting when we have multiple local entries
for an approval and remove entries subsequent to the first.
The first entry will remain and either be removed or have its
value updated as necessary.

Change-Id: Ifdc6273f1d5d4e83124ec30ff454c46e3e3af2d3
2015-02-13 07:04:13 -08:00
Jenkins
ac6b77c71e Merge "Always display full date" 2015-01-28 00:23:57 +00:00
Jenkins
7d3a47d91b Merge "Use category min/max in change list colors" 2015-01-28 00:23:51 +00:00
Jenkins
5749f511c9 Merge "Colorize votes on change list" 2015-01-28 00:23:44 +00:00
Jenkins
c36f83c4f8 Merge "Thread changes" 2015-01-28 00:22:20 +00:00
Jenkins
a38548a7d8 Merge "Handle (ignore) binary file diffs" 2015-01-23 18:57:52 +00:00
Jeremy Stanley
480610506c Handle (ignore) binary file diffs
If git diff detects a binary file with differences, it might add
some (currently) unparseable text to the diff. Ignore it to avoid an
error.

Change-Id: Ib4f615e2f2bd8d633657949c8732556b4a0575c6
2015-01-23 18:55:52 +00:00
Jenkins
5ee441fe8e Merge "Only decode email if already encoded" 2015-01-23 01:33:26 +00:00
James Polley
f5aa84d896 Always display full date
It's January 4. Just because a change was updated 5 days ago is no
reason to be merely telling me it was updated in '2014' - that makes it
impossible for me to tell the difference between a 5-day-old change and
a 369-day-old change.

(if I'd gotten around to fixing this on Jan 1 when it first bugged me, I
would have been talking about changes that were mere second old being
lumped in with changes almost a year old)

For changes performed today, the Updated column will show the time of
day. For older changes, this change changes the date presentation for
all dates in the Updated column to be ISO-8601 date format, following
the recommendations in that most canonical of sources,
http://xkcd.com/1179/

Change-Id: I4702ff5f226a3eb0cdeb258856686e6e0eaef41d
2015-01-21 17:06:46 -08:00
James E. Blair
c320a48c2a Use category min/max in change list colors
When colorizing the votes on the change list, look up the category
min and max values to use the stronger versions of those colors
only if the min or max values are present.

Change-Id: I37525f0d9cda09b644a4a9dac5266cb6d56ca346
2015-01-21 17:06:46 -08:00
Antoine Musso
2da6039416 Colorize votes on change list
The list of changes for a given project has two columns showing the max
vote for each change. Apply the min/max color on the votes, which with
the default pallette yields red for negative scores and green for
positive ones.

The palette has supports for slightly different color when the vote is
not the maximum allowed. Unfortunately the Gerrit API does not seem to
expose the label scores available to a project which make it impossible
to finely tune the color.  Assuming the color of the max/min scores will
work fine for most users.

Change-Id: I9f42be4cf41466a3500dcd98f7ad1cb6187b62a9
2015-01-21 17:06:46 -08:00
James E. Blair
b6f20ee70b Thread changes
Use the dependency information of the most recent revisions to
create a threaded view of changes.

Also, use a more efficient query to collect the children of a
change in the change view.

Change-Id: I1cbef9fe7c4f1822b8541e5b4d0e7d2fe2e180a9
2015-01-21 17:06:42 -08:00
Jeremy Stanley
12edc3aaf9 Only decode email if already encoded
* gertty/gitrepo.py(CommitContext.decorateMessage): A regression was
introduced by 3e23dba where some platforms already used unicode for
the author.email and committer.email values. In those circumstances
attempting to decode from UTF-8 fails spectacularly, so now we only
decode when we need to.

Change-Id: I267a4cb7ff35a8c864a7f3396abd5bf44ecd1ffc
2015-01-16 19:36:41 +00:00
James E. Blair
84e072e172 Protect against null owner in change view
If the change has no owner, do not dereference it in the change
screen.

Change-Id: I1c7b256ae882a59a1107f203bbb5a2f97feb59f0
2015-01-16 14:43:01 +13:00
Jenkins
bfb5deff32 Merge "Always refresh the screen on pop" 2015-01-16 00:31:05 +00:00
Jenkins
13370a2fe8 Merge "Do not use urwid 1.3.0" 2015-01-16 00:30:50 +00:00
Jenkins
9b60c334d8 Merge "Colorize values in review dialog" 2015-01-16 00:24:03 +00:00
Jenkins
77f586b490 Merge "Include descriptions in review dialog" 2015-01-16 00:23:47 +00:00
Jenkins
85858e1e5f Merge "Fix vote order in review dialog box" 2015-01-16 00:23:34 +00:00