Even though we won't usually display it, binary data may show up
in a diff. We can't decode it to display it, so just replace it
with a placeholder string so we don't crash.
Change-Id: I4794e707745ed8315afec00c1981e239ec98ef0e
There are some lines which were being read as byte arrays and
were not decoded into strings which was causing them to bypass
tab expansion (because they caused an exception which was caught
and the un-expanded text was used instead). Correct those cases
and disable the exception handler so that we can identify any
other cases by triggering a crash.
Change-Id: I4b34132290fc8611cc770d572068197b33c0789c
tabs are displayed as question mark by urwid, so need replacing.
While we are replacing, might as well mark them like in the web UI.
Ideally I would want to use a slightly different color for them,
but that would require to add many new colors in the config (context,
full new line, part of new line) and would not be very compatible
with 8-colors terminals -- the '»' character is hopefully rarely used
enough to be useable as is.
Change-Id: Ic974774bf546765fa5b3e9266aee8ff973865502
If a change has many revisions, loading the change screen may be
slow because we verify the presence of each commit and its parent
individually.
Instead, do that in a batch to speed things up.
Change-Id: Ib4b1c34500b98b8bb7307a5aaca86802a15e635d
This commit adds trailing-whitespace style for emphasizing. In gerrit,
we can find a trailing-whitespace very easily because it is emphasized
in red. So this commit imitates it.
Change-Id: Ie3f35c678093c51d8e39aeeaab2ea17d504e89fb
This commit adds a new config option 'git-url', where the
base URL can be specified to anything recognised by git-clone:
https://www.kernel.org/pub/software/scm/git/docs/git-clone.html#URLS
This is useful if the values provided by gerrit are incorrect, or if
you have access to a gerrit mirror closer to you.
Change-Id: I35ee5540aad2f27125ec15e6e933ac1ad3f3050e
GitPython had a very incompatible change that breaks any call that
uses a single character option (e.g., -U) that requires no space
between the option and the value. So far, this breaks the diff API
where we used the -U option instead of the long option equivalent.
For history:
https://github.com/gitpython-developers/GitPython/issues/382
So far, I've only seen one place where this bites gertty. Since the
GitPython author has stated this will not be reverted or fixed, having
a permanent cap on that library seems harsh as we won't get any other
bug fixes.
This fixes the known/found areas where we are affected.
Change-Id: Iadb279234af2ea01fbff35dc629c01dae5a3195c
The update to GitPython that supports easily detecting the filenames
in file-permissions-only changes merged a year ago. Start using it
and raise the mininum GitPython version to one which supports it.
Change-Id: I9a5104a4b399dee0d9e029fd0b10e37b8aafd3f8
8377e0a went a bit too far and removed some code that was necessary
for 3.4 but broke some utf-8 in git commits. This restores most
of what that removed, with one change that causes it to work with
the test commits listed at the top of the file.
Change-Id: Id39d7799f9c210a0ff0a80aeef34681eb6fe5770
Commit 74877d2 added improved support for python3 but introduced
some regressions around unicode handling.
Inspired-By: James E. Blair <jeblair@linux.vnet.ibm.com>
Change-Id: I424a921d80959777ff72df499c5931a21dc0dccb
In environments without py27, gertty was unable to run. This patch
addresses all the Py3K issues discovered when getting gertty running in
a py34-only environment.
Change-Id: I32a06f9768bdeaf8e95ddf9a9e54c79059fbaa2f
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
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
By default, remove changes (and associated git refs) that have been
closed for more than 2 months.
Change-Id: I5d1176b13a7c0fdaf12e346537fd7e1251868461
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
The logic to decide from where to fetch refs is getting complicated
and depends on the full repo url and ref. This information can be
different for each revision of a change, but is only needed in the
rare case that a local repo was damaged or removed. Rather than
storing all of this information in the database for what should be
a rare event, simply sync any changes that have missing refs and
use the normal code path for deciding where to fetch refs.
Change-Id: I4308db51b4847163b255686a62d5bad4e6226b4d
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
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
* 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
We need more control over diff colorization for proper rendering
and processing. Ensure that local settings don't cause us to
blow up when we're doing it.
Change-Id: I07fc445d9328c9df1ed52e8b328cce6fbea78f43
This should probably never happen, but it has anyway, so assume the
email field is a utf8 string. This should avoid crashing in case
someone has a utf8 email, but may not be a complete solution to
the case that an email is in a non-ascii, non-utf8 charset.
Change-Id: I95ed91e5fdfe35b73550e1824e609a0b1d388b3a
Now that change refs are stored locally, the only time a local repo
should be missing revisions is when it is newly cloned. Handle the
case where a user deletes the local repo automatically (when gertty
starts and a repo does not exist for a subscribed project, perform
a missing refs check on that project).
If the user knows something is wrong, they can supply the
--fetch-missing-refs flag at startup and an exhaustive check will
be run of all projects.
Otherwise, do nothing.
Change-Id: Iedebbe4b05ec1293b82c651587e42004444dc4a8
When adding (or presumably removing) an empty file, there is no
diff header, but that's where Gertty was getting the filenames.
Instead, get them from the git blob itself.
Change-Id: Ib2908aaf1d7554df53b5fb262017d85f3a560066
Story: 161
In the case that the final line of a file only had a newline
change, the line would be omitted from the old side of the diff.
Change-Id: I1e2e67fda4943ea38152a3ddd0004aa9210a9fa5
Story: 158
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
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
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
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
If both files have no newline at EOF, diff will notify us in the
context, but that case wasn't handled by the parser.
https://storyboard.openstack.org/#!/story/84
Change-Id: Ib2f1b4b4c9d8f38a983300e7026331754592705f
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
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
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