Review Board now displays the list of commits for repos using rb-gateway.

Review Request #9302 — Created Oct. 21, 2017 and submitted

Information

rb-gateway
master
146ae2d...

Reviewers

The list of commits on the New Review Request page was blank for repositories
using rb-gateway. This was due to Time.String() mishandling the timezone
offset. The problematic instances of Time.String() were replaced by
Time.Format("2006-01-02T15:04:05-0700").

Initially, requesting a list of commits yielded entries like the one below.
Notice the repetition of the timezone offset -0400 -0400.

http :8888/repos/testRepo1/branches/master/commits PRIVATE-TOKEN:dXNlcm5hbWU6cGFzc3dvcmQ=

"author": "Henri-Philippe Marceau", 
"date": "2017-10-08 12:17:21 -0400 -0400", 
"id": "704456ac9ec646c4f6316f8975d3d04fab32d7cb", 
"message": "modified FILEA\n", 
"parent_id": "2dd9a09b624597179d19b05da5b503bc4249f3eb"

Then, after the first attempt at fixing the problem, the timezone offset
occurred only once but lost its leading zero and was incorrect -700.

http :8888/repos/testRepo1/branches/master/commits PRIVATE-TOKEN:dXNlcm5hbWU6cGFzc3dvcmQ=

"author": "Henri-Philippe Marceau", 
"date": "2017-10-08T12:17:21-700", 
"id": "704456ac9ec646c4f6316f8975d3d04fab32d7cb", 
"message": "modified FILEA\n", 
"parent_id": "2dd9a09b624597179d19b05da5b503bc4249f3eb"

Finally, Time.Format("2006-01-02T15:04:05-0700") was introduced, and the
desired date-time output was achieved, -0400.

http :8888/repos/testRepo1/branches/master/commits PRIVATE-TOKEN:dXNlcm5hbWU6cGFzc3dvcmQ=

"author": "Henri-Philippe Marceau", 
"date": "2017-10-08T12:17:21-0400", 
"id": "704456ac9ec646c4f6316f8975d3d04fab32d7cb", 
"message": "modified FILEA\n", 
"parent_id": "2dd9a09b624597179d19b05da5b503bc4249f3eb"

To maintain consistency, both GetCommits & GetCommit, in git_repository.go,
were updated. The following is the output of a GetCommit request.

http :8888/repos/testRepo1/commits/8619c0d73748feeaa568c3c2a5378ad5332efa84 PRIVATE-TOKEN:dXNlcm5hbWU6cGFzc3dvcmQ=

"author": "Henri-Philippe Marceau", 
"date": "2017-09-29T21:52:51-0400",
...

To ensure that these changes didn't break anything, the unit tests were run
with go test:

PASS
ok      github.com/reviewboard/rb-gateway   0.096s

Also, the lists of commits for repositories using rb-gateway are now being
displayed.

david
  1. Ship It!
  2. 
      
hmarceau
  1. Ship It!

  2. 
      
brennie
  1. Ship It!
  2. 
      
hmarceau
Review request changed
Status:
Completed
Change Summary:
Pushed to master (c63823d)