Skip to content
  1. Nov 19, 2019
  2. Nov 17, 2019
    • Mike Frysinger's avatar
      upload/editor: fix bytes/string confusion · 70c54dc2
      Mike Frysinger authored
      
      
      The upload module tries to turn the strings into bytes before passing
      to EditString, but it combines bytes & strings causing an error.  The
      return value might be bytes or string, but the caller only expects a
      string.  Lets simplify this by sticking to strings everywhere and have
      EditString take care of converting to/from bytes when reading/writing
      the underlying files.  This also avoids possible locale confusion when
      reading the file by forcing UTF-8 everywhere.
      
      Bug: https://crbug.com/gerrit/11929
      Change-Id: I07b146170c5e8b5b0500a2c79e4213cd12140a96
      Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/245621
      Reviewed-by: default avatarDavid Pursehouse <dpursehouse@collab.net>
      Tested-by: default avatarMike Frysinger <vapier@google.com>
      70c54dc2
    • Mike Frysinger's avatar
      prune: handle branches that track missing branches · 6da17751
      Mike Frysinger authored
      
      
      Series of steps:
      * Create a local "b1" branch with `repo start b1` that tracks a remote
        branch (totally fine)
      * Manually create a local "b2" branch with `git branch --track b1 b2`
        that tracks the local "b1" (uh-oh...)
      * Delete the local "b1" branch manually or via `repo prune` (....)
      * Try to process the "b2" branch with `repo prune`
      
      Since b2 tracks a branch that no longer exists, everything blows up
      at this point as we try to probe the non-existent ref.  Instead, we
      should flag this as unknown and leave it up to the user to resolve.
      
      This probably could come up if a local branch was tracking a remote
      branch that was deleted from the server, and users ran something like
      `repo sync --prune` which cleaned up the remote refs.
      
      Bug: https://crbug.com/gerrit/11485
      Change-Id: I6b6b6041943944b8efa6e2ad0b8b10f13a75a5c2
      Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/236793
      Reviewed-by: default avatarDavid Pursehouse <dpursehouse@collab.net>
      Reviewed-by: default avatarKirtika Ruchandani <kirtika@google.com>
      Reviewed-by: default avatarMike Frysinger <vapier@google.com>
      Tested-by: default avatarMike Frysinger <vapier@google.com>
      6da17751
  3. Nov 14, 2019
    • Mike Frysinger's avatar
      sync: try to fast forward merge branches before checking published state · 2ba5a1e9
      Mike Frysinger authored
      
      
      If the local branch changed state since its last upload, the data
      cached in .git/config related to the last uploaded CL might not be
      that relevant.  If we're able to fast forward merge to the latest
      tree state, then let's do that.  This would be akin to checking
      out a detached head before syncing where we already switch state.
      
      If we aren't able to fast forward merge, then it's not a big deal
      as we'll continue on to the existing branch checking logic.
      
      This would be easy to reproduce by doing something like:
        $ repo start foo .
        $ git revert HEAD
        $ repo upload --cbr .
        $ git reset --hard HEAD^
        <CL is merged>
        $ repo sync .
        <we can fast forward>
      
      Change-Id: I7d62f3d1ba5314a349d85b4dbb0ec8352eca18bb
      Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/238552
      Tested-by: default avatarMike Frysinger <vapier@google.com>
      Reviewed-by: default avatarMichael Mortensen <mmortensen@google.com>
      Reviewed-by: default avatarMike Frysinger <vapier@google.com>
      2ba5a1e9
  4. Nov 13, 2019
    • Mike Frysinger's avatar
      sync: merge project updates with status bar · 3538dd22
      Mike Frysinger authored
      
      
      The current sync output displays "Fetching project" and "Checking out
      project" messages and progress bar updates independently leading to a
      lot of spam.  Lets merge these periodic outputs with the status bar to
      get a little bit tighter output in the normal case.  This doesn't solve
      all our problems, but gets us closer.
      
      Bug: https://crbug.com/gerrit/11293
      Change-Id: Icd627830af4dd934a9355b7ace754b56dc96cfef
      Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/244934
      Reviewed-by: default avatarDavid Pursehouse <dpursehouse@collab.net>
      Tested-by: default avatarMike Frysinger <vapier@google.com>
      3538dd22
    • Mike Frysinger's avatar
      sync: add sanity check for local checkouts missing network · b610b850
      Mike Frysinger authored
      
      
      If you run `repo sync -l foo` without first `repo sync -n foo`,
      repo sets up an invalid gitdir tree that gets wedged and requires
      manual recovery.  Add a sanity check to abort cleanly first.
      
      Change-Id: Iad865ea860a3f1fd2f39ce683fe66bd4380745a5
      Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/244732
      Reviewed-by: default avatarDavid Pursehouse <dpursehouse@collab.net>
      Tested-by: default avatarMike Frysinger <vapier@google.com>
      b610b850
    • Vadim Bendebury's avatar
      sync: report list of failing git trees · dff91949
      Vadim Bendebury authored
      
      
      When repo sync fails because some git trees are not in clean state and
      as such can not be rebased automatically, it is a pain to figure out
      which trees are the culprits.
      
      With this patch the list of offending trees is printed when repo sync
      reports checkout errors.
      
      TEST=ran 'repo sync' and observed the proper list of directories show
           up after the final error message
      
      Bug: https://crbug.com/gerrit/11293
      Change-Id: Icdf1a03e9014ecb184f331f513cc9a2efc7d11ed
      Signed-off-by: default avatarVadim Bendebury <vbendeb@google.com>
      Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/244053
      Reviewed-by: default avatarMike Frysinger <vapier@google.com>
      dff91949
  5. Nov 12, 2019
    • Mike Frysinger's avatar
      use open context managers in more places · 3164d40e
      Mike Frysinger authored
      
      
      Use open() as a context manager to simplify the close logic and make
      the code easier to read & understand.  This is also more Pythonic.
      
      Change-Id: I579d03cca86f99b2c6c6a1f557f6e5704e2515a7
      Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/244734
      Reviewed-by: default avatarDavid Pursehouse <dpursehouse@collab.net>
      Tested-by: default avatarMike Frysinger <vapier@google.com>
      3164d40e
    • Mike Frysinger's avatar
      sync: make .git init more robust · f4545126
      Mike Frysinger authored
      
      
      Hitting Ctrl-C in the middle of this func will leave the .git in a
      bad state that requires manual recovery.  The code tries to catch
      all exceptions and recover by deleting the incomplete .git dir, but
      it omits KeyboardInterrupt which Exception misses.
      
      We could add that to the recovery path, but we can make this more
      robust with a different approach: set up everything in .git.tmp/
      and only move it to .git/ once we've fully initialized it.
      
      Change-Id: I0f5b97f2e19fc39cffc3e5e23993a2da7220f4e3
      Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/244733
      Reviewed-by: default avatarDavid Pursehouse <dpursehouse@collab.net>
      Tested-by: default avatarMike Frysinger <vapier@google.com>
      f4545126
  6. Oct 22, 2019
    • Mike Frysinger's avatar
      forall: add an --ignore-missing option · b466854b
      Mike Frysinger authored
      
      
      In CrOS, our infra has to deal with partial checkouts constantly
      (for a variety of reasons).  To help reset back to a good state,
      we run git commands via `repo forall`, but don't care about the
      missing checkouts.  Add a flag so we can disambiguate between
      missing repos and failing git subcommands.
      
      Bug: https://crbug.com/1013377
      Bug: https://crbug.com/1013623
      Change-Id: Ie3498c6d111276c60d2ecedbba21bfa778588d50
      Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/241935
      Reviewed-by: default avatarDavid Pursehouse <dpursehouse@collab.net>
      Tested-by: default avatarMike Frysinger <vapier@google.com>
      v1.13.7.1
      b466854b
  7. Oct 11, 2019
    • Mike Frysinger's avatar
      python-support: adjust major versions · d1e93dd5
      Mike Frysinger authored
      
      
      The plan previously documented was <=1.13.x is Python 2 and >=1.14.x
      is Python 3.  Other projects that migrated Python versions and drop
      support for older have tended to take a more drastic version jump to
      make it clearer to users.  So lets adjust the plan to say <=1.x will
      support Python 2, and >=2.x will be Python 3-only.
      
      This also allows us to harmonize the repo launcher version.  It is
      currently sitting at v1.26 and has been incremented independently of
      the repo version for the life of the project.  While we might know
      these lower nuances, pretty much no one else does and it just leads
      to confusion: do I know version 1.26 or version 1.13.7?  Or do I
      have both?  What does that even mean?
      
      Once we update the major version to 2.0.0, we can also adjust the
      launcher script to 2.0.0, and then the launcher release process will
      be tied to a new repo release in general.
      
      Bug: https://crbug.com/gerrit/10418
      Change-Id: Idb2257371a06e56d2923cf717345c028f49176a2
      Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/240372
      Reviewed-by: default avatarDavid Pursehouse <dpursehouse@collab.net>
      Tested-by: default avatarMike Frysinger <vapier@google.com>
      d1e93dd5
  8. Oct 09, 2019
    • Mike Frysinger's avatar
      command: filter projects by active manifest groups · e778e57f
      Mike Frysinger authored
      
      
      `repo forall <proj>` will look up all <proj> in the manifest for all
      manifest groups regardless of which are active.  If <proj> is checked
      out to different locations depending on the group, this ultimately
      fails as we're unable to locate all of them.
      
      Simple fix is to only include projects that match the manifest groups
      that we already passed down & initialized to the active set, and that
      we already use when getting the default project list.
      
      Bug: https://crbug.com/gerrit/11677
      Bug: https://crbug.com/1011226
      Change-Id: I975f10f9a9e5a1cad7d87344123f8003732dab27
      Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/239652
      Tested-by: default avatarMike Frysinger <vapier@google.com>
      Reviewed-by: default avatarRaul Rangel <rrangel@chromium.org>
      Reviewed-by: default avatarDavid Pursehouse <dpursehouse@collab.net>
      v1.13.7
      e778e57f
  9. Oct 05, 2019
    • Mike Frysinger's avatar
      info: fix "current" output · f1c5dd8a
      Mike Frysinger authored
      
      
      The "Current revision" field shows the revision as listed in the
      manifest.  I think most users expect this to show the revision
      that the git tree is checked out to instead.  Switch the output
      to show that revision instead, and add a "Current branch" if it
      matches a local branch.
      
      Change-Id: Ib546f5ebbc8a23875fbd14bf166fbe95b7dd244e
      Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/239240
      Reviewed-by: default avatarDavid Pursehouse <dpursehouse@collab.net>
      Tested-by: default avatarMike Frysinger <vapier@google.com>
      f1c5dd8a
    • Rashed Abdel-Tawab's avatar
      Only import imp on py2 · 2058c636
      Rashed Abdel-Tawab authored
      
      
      imp is deprecatedon py3. It's also not used with py3, so just move it
      to the py2 import block
      
      Test: run `repo` command and verify warning is no longer present
      Test: verify `repo sync` and `repo upload` function as expected
      Change-Id: I9d59403d7819c4a478c9f54cbef114f8a96486a5
      Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/239713
      Tested-by: default avatarRashed Abdel-Tawab <rashedabdeltawab@gmail.com>
      Reviewed-by: default avatarMike Frysinger <vapier@google.com>
      2058c636
  10. Oct 01, 2019
  11. Sep 24, 2019
  12. Sep 19, 2019
  13. Sep 18, 2019
  14. Sep 17, 2019
  15. Sep 13, 2019
    • Mike Frysinger's avatar
      sync: improve output with intermingled progress bars and status · 70d861fa
      Mike Frysinger authored
      
      
      When displaying progress bars, we use \r to reset the cursor to the
      start of the line before showing the new update.  This assumes the
      new line will fully erase whatever was displayed there previously.
      The "done" codepath tries to handle this by including a few extra
      spaces at the end of the message to "white out" what was there.
      
      Lets replace that hack with the standard ECMA escape sequence that
      clears the current line completely.  This is the CSI "erase in line"
      sequence that the terminal will use to delete all content.  The \r
      is still needed to move the cursor to the start of the line.  Using
      this sequence should be OK since we're already assuming the terminal
      is ECMA compliant with our use of coloring sequences.  We also put
      the \r after the CSI sequence on the off chance the terminal can't
      process it and displays a few bytes of garbage.
      
      The other improvement is to the syncbuffer API.  When it dumps its
      status information, it almost always comes after a progress bar
      update which leads to confusing comingled output.  Something like:
        Fetching projects: 100% (2/2) error: src/platform2/: branch ...
      Since the progress bar is "throw away", have the syncbuffer reset
      the current output to the start of the line before showing whatever
      messages it has queued.
      
      Bug: https://crbug.com/gerrit/11293
      Change-Id: I6544d073fe993d98ee7e91fca5e501ba5fecfe4c
      Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/236615
      Reviewed-by: default avatarDavid Pursehouse <dpursehouse@collab.net>
      Tested-by: default avatarMike Frysinger <vapier@google.com>
      70d861fa
  16. Sep 12, 2019
  17. Sep 04, 2019
  18. Aug 31, 2019
  19. Aug 28, 2019
    • Mike Frysinger's avatar
      split out cli validation from execution · ae6cb08a
      Mike Frysinger authored
      
      
      A common pattern in our subcommands is to verify the arguments &
      options before executing things.  For some subcommands, that check
      stage is quite long which makes the execution function even bigger.
      Lets split that logic out of the execute phase so it's easier to
      manage these.
      
      This is most noticeable in the sync subcommand whose Execute func
      is quite large, and the option checking makes up ~15% of it.
      
      The manifest command's Execute can be simplified significantly as
      the optparse configuration always sets output_file to a string.
      
      Change-Id: I7097847ff040e831345e63de6b467ee17609990e
      Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/234834
      Reviewed-by: default avatarDavid Pursehouse <dpursehouse@collab.net>
      Tested-by: default avatarMike Frysinger <vapier@google.com>
      v1.13.5
      ae6cb08a
    • Mike Frysinger's avatar
      add a --trace-python option · 3fc15728
      Mike Frysinger authored
      
      
      This can help debug issues by tracing all the repo python code with
      the standard trace module.
      
      Change-Id: Ibb7f4496ab6c7f9e130238ddf3a07c831952697a
      Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/234833
      Tested-by: default avatarMike Frysinger <vapier@google.com>
      Reviewed-by: default avatarDavid Pursehouse <dpursehouse@collab.net>
      3fc15728
  20. Aug 27, 2019
  21. Aug 23, 2019