Homec4science

Allow Git repositories to track only some branches

Authored by epriestley <git@epriestley.com> on Dec 29 2011, 18:14.

Description

Allow Git repositories to track only some branches

Summary:
Some installs use Git as the backbone of a CI framework or use a Git remote to
share patches. The tracker scripts currently recognize associated revisions as
"Committed" when they appear in any branch, even if that branch is
"alincoln-personal-development_test_hack" or whatever.

To address the broadest need here, allow Git repositories to be configured to
track only certain branches instead of all branches.

This doesn't allow you to import a branch into Diffusion but ignore it in
Differential. Supporting that is somewhat technically complicated because the
parser currently goes like this:

  • Look at HEAD of all branches.
  • For any commits we haven't seen before, follow them back to something we

have seen (or the root).

  • "Discover" everything new.

Since this doesn't track <branch, commit> pairs, we currently don't have enough
information to tell when a commit appears in a branch for the first time, so we
don't have anywhere we can put a test for whether that branch is tracked and do
the Differential hook only if it is.

However, I think this cruder patch satisfies most of the need and is simple and
obvious in its implementation.

See also D1263.

Test Plan:

  • Updated a Git repository with various filters: "", "master, remote", "derp",

" ,,, master ,,,,,"

  • Edited SVN and Mercurial repositories to verify they didn't get caught in

the crossfire.

  • Ran daemon in debug mode on libphutil with filter "derp", got exception

about no tracked branches. Ran with filter "master", got tracking. Ran with no
filter, got tracking.

  • Looked at Diffusion with "derp" and "master", saw no branches and "master"

respectively.

  • Added unit tests to cover filtering logic.

Reviewers: btrahan, jungejason, nh, fratrik

Reviewed By: fratrik

CC: aran, fratrik, epriestley

Maniphest Tasks: T270

Differential Revision: https://secure.phabricator.com/D1290

Details

Committed
epriestley <git@epriestley.com>Jan 4 2012, 19:20
Pushed
aubortJan 31 2017, 17:16
Parents
rPHec1df21befae: Add getStrList() to AphrontRequest
Branches
Unknown
Tags
Unknown

Event Timeline

epriestley <git@epriestley.com> committed rPH99231ebba424: Allow Git repositories to track only some branches (authored by epriestley <git@epriestley.com>).Jan 4 2012, 19:20