Add support for reading and writing history metadata

Review Request #8278 — Created July 11, 2016 and submitted — Latest diff uploaded

Information

RBTools
dvcs
4f3c6e5...

Reviewers

For server-side detection of rebases and commit amends, we need to keep
track of some metadata indicating the original SHA1 of commits. With
git, we can store this metadata in git notes.

git notes allows for storing arbitrary metadata associated with each
commit. We store the SHA1 of the commit in a special notes ref,
rbt-history-metadata. This way, we do not interfere with notes that
users may be using. We also add this ref to the list of refs to be
rewritten during rebases and amends.

When an amend occurs, the SHA1 of the commit will change, but the
stored SHA1 will not, so we will be able to detect that commit was
amended. Likewise, when a squash occurs during a rebase, the SHA1 will
change but the stored metadata will be the SHA1 hashes of all the
squashed commits, so we can also know when a squash occurs. We can then
upload this metadata when doing rbt post so that Review Board can
detect history changes server side.

Using https://reviews.reviewboard.org/r/8276/, I was able to do the
following:

  • Upload a review request with multiple commits.
  • Squash the commits together locally.
  • Update the review request.

I observed that the original commits were set in the Review Board
database.

    Loading...