Google is committed to advancing racial equity for Black communities. See how.

fx sync-to

Sync the local Fuchsia source tree to a given state

usage: fx sync-to [-h|--help] <STATE>

To reproduce builds at a given repo state, or bisect bugs among a series of
checkins, this command synchronizes the local Fuchsia source tree to a given
state. The state can be specified in one of the following ways:

 BUILD_ID: a large number like '8938070794014050064' (preceded or not by a
   'b' letter), which is the "Build #" in a builder's "Ended builds" page,
    for example:
      https://luci-milo.appspot.com/p/fuchsia/builders/try/core.x64-asan

 RELEASE_TAG: a string like "releases/0.20190927.1.1", representing a
   git tag in the //integration repository. To find available tags, run
   `git tags -l` in your local integration repository.

 BRANCH_NAME: a string like "refs/heads/releases/f1", representing a
   git branch (head) in the //integration repository.

 JIRI_HISTORY_TIMESTAMP: a timestamp like "2019-03-21T15:30:00-07:00".
   This is local to your tree, and represents a moment where you
   previously ran `jiri update`. To find available timestamps, look at
   files in ${FUCHSIA_DIR}/.jiri_root/update_history/

 INTEGRATION_GIT_COMMIT: a 3-40 character commit hash like "e9d97d1" in the
   integration repo. Can be optionally prefixed with 'git:' (e.g.
   "git:e9d97d1") to disambiguate from BUILD_ID. To find valid commits,
   look at your integration commit history:
      git -C ${FUCHSIA_DIR}/integration log --oneline

 "reset":
   Use "reset" to return to the top of the tree. This is equivalent to:
     git -C ${FUCHSIA_DIR}/integration checkout JIRI_HEAD && jiri update -gc

Known limitations:
- Does not work on CI builds triggered on repos other than integration (very
  rare). It works on all CQ builds and all CI builds triggered by
  integration.git commits.
- Does not respect `attributes`. Local attributes will not be overridden (so
  the checkout may contain some extra repositories), and
  attributes used by an infra build will not be reproduced

Examples:

# Sync to the source used by build https://ci.chromium.org/b/8835832080588336881
fx sync-to 8835832080588336881

# Sync to the source tagged as release 0.20210822.2.5:
fx sync-to releases/0.20210822.2.5

# Sync to the same tree updated in 2021-08-28T14:26:22-07:00 (this is
# local to your local tree - to reproduce, look for timestamps in your
# own .jiri_root/update_history directory):
fx sync-to 2021-08-28T14:26:22-07:00

# Sync to integration commit 901ed5b
# (https://fuchsia.googlesource.com/integration/+/901ed5bf7db253bb6feb4832ac1a752248e2361d):
fx sync-to 901ed5b

# Sync to release branch f1:
fx sync-to refs/heads/releases/f1

# Restore your source to the top of the tree:
fx sync-to reset

sync-to source code