revision: --ancestry-path
commitebdc94f3bec7ec54babb21b1d785af0cd75b21e6
authorJunio C Hamano <gitster@pobox.com>
Tue, 20 Apr 2010 20:48:39 +0000 (20 13:48 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 21 Apr 2010 08:15:33 +0000 (21 01:15 -0700)
tree777b3578254e6881a1fa45f1fc0e08283bf3288b
parentddd02b70f0d80fc3cac6b2f2c42005560d572413
revision: --ancestry-path

"rev-list A..H" computes the set of commits that are ancestors of H, but
excludes the ones that are ancestors of A.  This is useful to see what
happened to the history leading to H since A, in the sense that "what does
H have that did not exist in A" (e.g. when you have a choice to update to
H from A).

       x---x---A---B---C  <-- topic
      / \
     x---x---x---o---o---o---o---M---D---E---F---G  <-- dev
    /   \
   x---o---o---o---o---o---o---o---o---o---o---o---N---H  <-- master

The result in the above example would be the commits marked with caps
letters (except for A itself, of course), and the ones marked with 'o'.

When you want to find out what commits in H are contaminated with the bug
introduced by A and need fixing, however, you might want to view only the
subset of "A..B" that are actually descendants of A, i.e. excluding the
ones marked with 'o'.  Introduce a new option --ancestry-path to compute
this set with "rev-list --ancestry-path A..B".

Note that in practice, you would build a fix immediately on top of A and
"git branch --contains A" will give the names of branches that you would
need to merge the fix into (i.e. topic, dev and master), so this may not
be worth paying the extra cost of postprocessing.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
revision.c
revision.h
t/t6019-rev-list-ancestry-path.sh [new file with mode: 0755]