Skip to content

Commit

Permalink
Stop using Gerrit (googlesource.com), switch to just GitHub & PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
bradfitz committed Jun 5, 2019
1 parent 8e42f0f commit 41f5d4a
Show file tree
Hide file tree
Showing 13 changed files with 62 additions and 461 deletions.
46 changes: 14 additions & 32 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@

## Getting Started

Perkeep contributors regularly use Linux and OS X, and both are
Perkeep contributors regularly use Linux and macOS, and both are
100% supported.

Developing on Windows is sometimes broken, but should work. Let us
Developing on Windows is sometimes broken, but should work. Let us
know if we broke something, or we accidentally depend on some
Unix-specific build tool somewhere.

See https://perkeep.org/doc/contributing for information on how to
contribute to the project and submit patches. Notably, we use Gerrit
for code review. Our Gerrit instance is at https://perkeep.org/r/
contribute to the project and submit patches.

See architecture docs: https://perkeep.org/doc/

Expand All @@ -21,15 +20,7 @@ godoc.org.
It's recommended you use git to fetch the source code, rather than
hack from a Perkeep release's zip file:

$ git clone https://perkeep.googlesource.com/perkeep perkeep.org

(We use github for distribution but its code review system is not as
nice as Gerrit, so we don't use its Pull Request mechanism. The Gerrit
git server & code review system is the main repo. See
https://perkeep.org/doc/contributing for how to use them. We might
support github for pull requests in the future, once it's properly
integrated with external code review tools. We had a meeting with
Github to discuss the ways in which their code review tools are poor.)
$ git clone https://github.com/perkeep/perkeep.git perkeep.org

On Debian/Ubuntu, some deps to get started:

Expand All @@ -42,11 +33,15 @@ test environment.

## Building devcam

We have a development tool to help with Perkeep development that's
named `devcam` (for historical reasons: Perkeep used to be named
Camlistore).

To build devcam:

$ go run make.go

And devcam will be in <camroot>/bin/devcam. You'll probably want to
And devcam will be in <pkroot>/bin/devcam. You'll probably want to
symlink it into your $PATH.

Alternatively, if your Perkeep root is checked out at
Expand Down Expand Up @@ -85,8 +80,8 @@ Before submitting a patch, you should check that all the tests pass with:
$ devcam test

You can use your usual git workflow to commit your changes, but for each
change to be reviewed you should merge your commits into one before submitting
to gerrit for review.
change to be reviewed you should merge your commits into one before sending
a GitHub Pull Request for review.

## Commit Messages

Expand All @@ -109,18 +104,9 @@ For example:
## Vendored Code

Changes to vendored third party code must be done using the dep tool.
Information on adding, removing and updating vendor deps can be found
in the [dep documentation](https://github.com/golang/dep/blob/master/README.md).

Once you have your changes and versions specified please run the
following commands to update the vendor directory with your changes:

$ dep ensure

To help track version changes please add the semantic version and the
revision in your commit message the version which you can find in the
Gopkg.lock file.
Changes to vendored third party code must be done using Go modules,
using at least Go 1.12, but often requiring the Go 1.13 development
tree.

## Contributors

Expand All @@ -135,8 +121,4 @@ before being submitted (which should be done anyway).

$ devcam hook

Finally, submit your code to gerrit with:

$ devcam review

Please update this file as appropriate.
75 changes: 0 additions & 75 deletions dev/devcam/hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,13 @@ package main

import (
"bytes"
"crypto/rand"
"errors"
"flag"
"fmt"
"io"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"regexp"
"sort"
"strings"

Expand Down Expand Up @@ -133,78 +130,6 @@ func (c *hookCmd) RunCommand(args []string) error {
cmdmain.ExitWithFailure = true
return err
}
case "commit-msg":
if err := c.hookCommitMsg(args[1:]); err != nil {
cmdmain.ExitWithFailure = true
return err
}
}
return nil
}

// stripComments strips lines that begin with "#" and removes the diff section
// contained in verbose commits.
func stripComments(in []byte) []byte {
if i := bytes.Index(in, ignoreBelow); i >= 0 {
in = in[:i+1]
}
return regexp.MustCompile(`(?m)^#.*\n`).ReplaceAll(in, nil)
}

// hookCommitMsg is installed as the git commit-msg hook.
// It adds a Change-Id line to the bottom of the commit message
// if there is not one already.
// Code mostly copied from golang.org/x/review/git-codereview/hook.go
func (c *hookCmd) hookCommitMsg(args []string) error {
if len(args) != 1 {
return errors.New("usage: devcam hook commit-msg message.txt")
}

file := args[0]
oldData, err := ioutil.ReadFile(file)
if err != nil {
return err
}
data := append([]byte{}, oldData...)
data = stripComments(data)

// Empty message not allowed.
if len(bytes.TrimSpace(data)) == 0 {
return errors.New("empty commit message")
}

// Insert a blank line between first line and subsequent lines if not present.
eol := bytes.IndexByte(data, '\n')
if eol != -1 && len(data) > eol+1 && data[eol+1] != '\n' {
data = append(data, 0)
copy(data[eol+1:], data[eol:])
data[eol+1] = '\n'
}

// Complain if two Change-Ids are present.
// This can happen during an interactive rebase;
// it is easy to forget to remove one of them.
nChangeId := bytes.Count(data, []byte("\nChange-Id: "))
if nChangeId > 1 {
return errors.New("multiple Change-Id lines")
}

// Add Change-Id to commit message if not present.
if nChangeId == 0 {
n := len(data)
for n > 0 && data[n-1] == '\n' {
n--
}
var id [20]byte
if _, err := io.ReadFull(rand.Reader, id[:]); err != nil {
return fmt.Errorf("could not generate Change-Id: %v", err)
}
data = append(data[:n], fmt.Sprintf("\n\nChange-Id: I%x\n", id[:])...)
}

// Write back.
if !bytes.Equal(data, oldData) {
return ioutil.WriteFile(file, data, 0666)
}
return nil
}
Expand Down
1 change: 0 additions & 1 deletion doc/todo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@

* The [TODO file](https://perkeep.googlesource.com/perkeep/+/master/TODO)
* The [issue tracker](https://github.com/perkeep/perkeep/issues) lists both features and bugs
* Thoughts on [modeling a blog](blog-notes.md)
104 changes: 0 additions & 104 deletions misc/commit-msg.githook

This file was deleted.

7 changes: 0 additions & 7 deletions misc/testfile

This file was deleted.

12 changes: 7 additions & 5 deletions website/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
This is the webserver that serves perkeep.org. You will need to build and
run it in order to preview changes to the documentation.
This directory contains the code & content for the perkeep.org
website. You will need to build the webserver and run it locally to
preview cahnges to the documentation:

go build
./website
$ cd <perkeep_checkout>/website
$ go install ./pk-web
$ pk-web

The webserver runs on port 31798.
The webserver runs on port 31798: http://localhost:31798/
Loading

0 comments on commit 41f5d4a

Please sign in to comment.