summaryrefslogtreecommitdiffstats
path: root/subcmds/sync.py
Commit message (Collapse)AuthorAgeFilesLines
* subcmds/sync.py: Fix typo in helpRoger Shimizu2020-06-061-1/+1
| | | | | | | | Change-Id: I70b63477241284249e395b8b0a220cb6f44f836b Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/270183 Reviewed-by: Mike Frysinger <vapier@google.com> Reviewed-by: David Pursehouse <dpursehouse@digital.ai> Tested-by: David Pursehouse <dpursehouse@digital.ai>
* sync: fix duplicate word in descriptionMike Frysinger2020-05-241-1/+1
| | | | | | | | Bug: https://crbug.com/gerrit/12814 Change-Id: Id722eec9a59dded588f13bc605ce2c94b4047265 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/268739 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: David Pursehouse <dpursehouse@digital.ai>
* Make partial clone imply no-clone-bundle by default.Xin Li2020-05-211-2/+6
| | | | | | | | | | | | | | | | | | For large projects, clone bundle is useful because it provided a way to efficiently transfer a large portion of git objects through CDN, without needing to interact with git server. However, with partial clones, the intention is to not download most of the objects, so the use of clone bundles would defeat the space savings normally seen with partial clones, as they are downloaded before the first fetch. A new option, --clone-bundle is added to override this behavior. Add a new repo.clonebundle variable which remembers the choice if explicitly given from command line at repo init. Change-Id: I03638474af303a82af34579e16cd4700690b5f43 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/268452 Tested-by: Xin Li <delphij@google.com> Reviewed-by: Jonathan Nieder <jrn@google.com>
* sync: add retry to fetch operationsGeorge Engelbrecht2020-04-021-0/+5
| | | | | | | | | | | | | Add retries with exponential backoff and jitter to the fetch operations. By default don't change behavior and enable behind the new flag '--fetch-retries'. Bug: https://crbug.com/1061473 Change-Id: I492710843985d00f81cbe3402dc56f2d21a45b35 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/261576 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: George Engelbrecht <engeg@google.com>
* init: rename --repo-branch to --repo-revMike Frysinger2020-03-181-1/+1
| | | | | | | | | | | | We refer to this as "revision" in help text, and in REPO_REV envvar, so rename to --repo-rev to be consistent. We keep --repo-branch for backwards compatibility, but as a hidden option. Bug: https://crbug.com/gerrit/11045 Change-Id: I1ecc282fba32917ed78a63850360c08469db849a Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/259352 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: David Pursehouse <dpursehouse@collab.net>
* sync: warn if not tracking a branchMike Frysinger2020-03-171-0/+7
| | | | | | | | | | | Since tracking a branch prevents repo from updating, make sure we warn people about the situation when using `repo sync`. Bug: https://crbug.com/gerrit/11045 Change-Id: I966513f510827cc93194f8df176c6745946bd739 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/258892 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: David Pursehouse <dpursehouse@collab.net>
* sync: fix os.environ logic errorsMike Frysinger2020-03-071-3/+3
| | | | | | | | | This is a dict to index, not a function to call. Change-Id: I0117eeaaa8b2ef4762ab6f0d22f9ffdaee961f52 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/258132 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: David Pursehouse <dpursehouse@collab.net>
* sync: Fix flake8 E125 and E129 warningsDavid Pursehouse2020-02-201-3/+3
| | | | | | | | | | | | | | - E129 visually indented line with same indent as next logical line - E125 continuation line with same indent as next logical line Fixed automatically by: autopep8 --in-place --select E125,E129 subcmds/sync.py Change-Id: Ia2f82f443e1e6a23ba22c6f9849c8485405aed0e Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/256092 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: David Pursehouse <dpursehouse@collab.net>
* project/sync: move DeleteProject helper to ProjectMike Frysinger2020-02-201-81/+4
| | | | | | | | | | | | Since deleting a source checkout involves a good bit of internal knowledge of .repo/, move the DeleteProject helper out of the sync code and into the Project class itself. This allows us to add git worktree support to it so we can unlock/unlink project checkouts. Change-Id: If9af8bd4a9c7e29743827d8166bc3db81547ca50 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/256072 Reviewed-by: Jonathan Nieder <jrn@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* project: set core.repositoryFormatVersion=1 when using extensionsMike Frysinger2020-02-191-2/+1
| | | | | | | | | | | When using extensions, make sure we set the git repo format version so git knows to check the extension compatibility. We can add a helper to the Project API to simplify this and make it foolproof. Change-Id: I9ab6c32d92fe2b8e5df6e2b080ca71556332e909 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/256035 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: Jonathan Nieder <jrn@google.com>
* add experimental git worktree supportMike Frysinger2020-02-191-6/+18
| | | | | | | | | | | | | | | | | This provides initial support for using git worktrees internally instead of our own ad-hoc symlink tree. It's been lightly tested which is why it's not currently exposed via --help. When people opt-in to worktrees in an existing repo client checkout, no projects are migrated. Instead, only new projects will use the worktree method. This allows for limited testing/opting in without having to completely blow things away or get a second checkout. Bug: https://crbug.com/gerrit/11486 Change-Id: Ic3ff891b30940a6ba497b406b2a387e0a8517ed8 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/254075 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: Mike Frysinger <vapier@google.com>
* assume environment always accepts stringsMike Frysinger2020-02-191-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Different Python & OS versions have different environ behavior wrt accepted types & encoding. Since we're migrating to be Python 3 only, lets change our code to assume strings always work as that's what the newer Python 3 does. This will fail under Python 2 for some env vars, mostly on Windows, but the effort of maintaining shim layers that can handle these edge cases isn't worth it when we're dropping that code. We leave the logic in the `repo` launcher for now as it is simple, and we want it to be able to switch versions a bit longer than the rest of the tree. Here's the support table: | *NIX | Windows | Python 2 | ASCII string | str or bytes, not unicode | Python 3 | str or bytes | str only | Windows uses strings natively in its environment all the time. But it doesn't allow unicode strings under Python 2, so we have to encode. Python 2 on *NIX is funky in that it always lowers to ASCII, so we had to manually encode to avoid errors regardless of unicode or str. Python 3 on Windows & *NIX will accept strings. *NIX will also accept bytes but Windows will not. Bug: https://crbug.com/gerrit/12145 Change-Id: I3cf8f95a06902754ea1f08ad4b28503f7063531b Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/248972 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: Michael Mortensen <mmortensen@google.com> Reviewed-by: Mike Frysinger <vapier@google.com>
* avoid negative variablesMike Frysinger2020-02-191-9/+9
| | | | | | | | | | | Trying to use booleans with names like "no_xxx" are hard to follow due to the double negatives. Invert all of them so we only have positive meanings to follow. Change-Id: Ifd37d0368f97034d94aa2cf38db52c723ac0c6ed Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/255493 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: David Pursehouse <dpursehouse@collab.net>
* Open temporary cookie file as writable in sync.pyCollin Fijalkovich2020-02-181-1/+1
| | | | | | | | | | | | | Named Temporary file defaults to mode 'w+b' which causes repo sync to fail. By opening the tmpcookiefile in PersistentTransport.request as writable, we are able to run sync successfully. Bug: https://crbug.com/gerrit/12370 Test: Ran smartsync successfully Change-Id: I01ddf915fc30eb3ff0e4d440a6f1aa261c63e88d Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/255692 Tested-by: Jonathan Nieder <jrn@google.com> Reviewed-by: Jonathan Nieder <jrn@google.com>
* sync: introduce --verbose optionMike Frysinger2020-02-171-3/+10
| | | | | | | | | | | | | This allows us to control sync output better by having three levels of output: quiet (only errors), default (progress bars), verbose (all the things). For now, we just put the chatty "already have persistent ref" message behind the verbose level. Bug: https://crbug.com/gerrit/11293 Change-Id: Ia61333fd8085719f3e99edb7b466cdb04031b67f Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/255414 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* sync: add a "finished" messageMike Frysinger2020-02-121-0/+3
| | | | | | | | | | | | | Some people find the existing output to be a bit confusing. It spews a lot of git output before exiting, but it's not exactly clear what the final state is when things pass. Add an explicit message. Bug: https://crbug.com/gerrit/10501 Change-Id: I9de83b595d3185feb820005b8fc81c6adc55b357 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/254732 Reviewed-by: Michael Mortensen <mmortensen@google.com> Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* drop old git_require checksMike Frysinger2020-02-121-2/+1
| | | | | | | | | | We've been requiring git-1.7.2 since Oct 2012, so we can safely drop the individual checks sprinkled throughout the code base for older. Change-Id: I1737fff7b3f27f475960b0bff9cb300aefd5d108 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/253135 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* Fix usage of bare 'except'David Pursehouse2020-02-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | flake8 reports: E722 do not use bare 'except' Replace them with 'except Exception' per [1] which says: Bare except will catch exceptions you almost certainly don't want to catch, including KeyboardInterrupt (the user hitting Ctrl+C) and Python-raised errors like SystemExit If you don't have a specific exception you're expecting, at least except Exception, which is the base type for all "Regular" exceptions. [1] https://stackoverflow.com/a/54948581 Change-Id: Ic555ea9482645899f5b04040ddb6b24eadbf9062 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/254606 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: David Pursehouse <dpursehouse@collab.net>
* Fix blank line issues reported by flake8David Pursehouse2020-02-121-0/+9
| | | | | | | | | | | | | | | | | | | | - E301 expected 1 blank line - E302 expected 2 blank lines - E303 too many blank lines - E305 expected 2 blank lines after class or function definition - E306 expected 1 blank line before a nested definition Fixed automatically with autopep8: git ls-files | grep py$ | xargs autopep8 --in-place \ --select E301,E302,E303,E305,E306 Manually fix issues in project.py caused by misuse of block comments. Change-Id: Iee840fcaff48aae504ddac9c3e76d2acd484f6a9 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/254599 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: David Pursehouse <dpursehouse@collab.net>
* Fix indentation issues reported by flake8David Pursehouse2020-02-121-20/+20
| | | | | | | | | | | | | | | | | | | | | - E121 continuation line under-indented for hanging indent - E122 continuation line missing indentation or outdented - E125 continuation line with same indent as next logical line - E126 continuation line over-indented for hanging indent - E127 continuation line over-indented for visual indent - E128 continuation line under-indented for visual indent - E129 visually indented line with same indent as next logical line - E131 continuation line unaligned for hanging indent Fixed automatically with autopep8: git ls-files | grep py$ | xargs autopep8 --in-place \ --select E121,E122,E125,E126,E127,E128,E129,E131 Change-Id: Ifd95fb8e6a1a4d6e9de187b5787d64a6326dd249 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/254605 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: David Pursehouse <dpursehouse@collab.net>
* Fix various whitespace issues reported by pyflakesDavid Pursehouse2020-02-121-3/+3
| | | | | | | | | | | | | | | | | | | | | | - E201 whitespace after '[' - E202 whitespace before '}' - E221 multiple spaces before operator - E222 multiple spaces after operator - E225 missing whitespace around operator - E226 missing whitespace around arithmetic operator - E231 missing whitespace after ',' - E261 at least two spaces before inline comment - E271 multiple spaces after keyword Fixed automatically with autopep8: git ls-files | grep py$ | xargs autopep8 --in-place \ --select E201,E202,E221,E222,E225,E226,E231,E261,E271 Change-Id: I367113eb8c847eb460532c7c2f8643f33040308c Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/254601 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: David Pursehouse <dpursehouse@collab.net>
* Remove redundant backslashesDavid Pursehouse2020-02-121-1/+1
| | | | | | | | | | | | | | | fleka8 reports: E502 the backslash is redundant between brackets Fixed automatically with autopep8: git-repo $ git ls-files | grep py$ | xargs autopep8 --in-place --select E502 Change-Id: I1486ae1d17206918474363daf518274c5be8daed Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/254602 Tested-by: David Pursehouse <dpursehouse@collab.net> Reviewed-by: Mike Frysinger <vapier@google.com>
* Fix tests for membership to use 'not in'David Pursehouse2020-02-121-1/+1
| | | | | | | | | | | flake8 reports: E713 test for membership should be 'not in' Change-Id: I4446be67c431b7267105b53478d2ceba2af758d7 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/254451 Tested-by: David Pursehouse <dpursehouse@collab.net> Reviewed-by: Mike Frysinger <vapier@google.com>
* Fix flake8 E251 unexpected spaces around keyword / parameter equalsDavid Pursehouse2020-02-121-15/+15
| | | | | | | | | | | Fixed automatically with autopep8: git ls-files | grep py$ | xargs autopep8 --in-place --select E251 Change-Id: I58009e1c8c91c39745d559ac919be331d4cd9e77 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/254598 Tested-by: David Pursehouse <dpursehouse@collab.net> Reviewed-by: Mike Frysinger <vapier@google.com>
* Remove trailing blank linesDavid Pursehouse2020-02-121-1/+0
| | | | | | | | | | | flake8 reports: W391 blank line at end of file Change-Id: I5498b2de2d1268d4f1f4b9e1760f9fa93a6da4cd Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/254594 Tested-by: David Pursehouse <dpursehouse@collab.net> Reviewed-by: Mike Frysinger <vapier@google.com>
* sync: change how we preserve objects in shared reposMike Frysinger2020-02-111-2/+13
| | | | | | | | | | | | | | | | | | | Some automatic git operations will prune objects on us, and not just the gc step. Normally we don't care, but with shared projects, we will have multiple git checkouts with refs that the others cannot see, but with a shared object dir. Any pruning of objects based on refs in just one repo can easily break the others. git-2.7.0 introduced a preciousObjects setting which tells git to never prune objects for this exact scenario: there might be refs in some location that git is unable to see. Change-Id: I781de27c5bbe1d4c70f0187566141c9cce088bd8 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/254392 Reviewed-by: Nasser Grainawi <nasser@codeaurora.org> Reviewed-by: David Riley <davidriley@google.com> Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* sync: try to checkout repos across sync failuresMike Frysinger2020-02-051-29/+57
| | | | | | | | | | | | | | | | | | | | | | Currently our default behavior is: * Try to sync all repos * If any errors seen, exit * Try to garbage collect all repos * If any errors seen, exit * Try to update local project list * If any errors seen, exit * Try to checkout out all local repos * If any errors seen, exit Users find these incomplete syncs confusing, so lets try to complete as much as possible by default and printing out summaries at the end. Bug: https://crbug.com/gerrit/11293 Change-Id: Idd17cc9c3bbc574d8a0f08a30225dec7bfe414cb Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/238554 Reviewed-by: Michael Mortensen <mmortensen@google.com> Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* sync: add option to skip manifest updateFredrik de Groot2020-02-051-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | The use case is any situation where your manifest does not exist on server, but where you still want to do full sync for the projects, without having your workspace manifest switched to other branch or forwarded to latest or similar. This allows syncing to a historical manifest in git log, that does not have a branch, as well as when integrating something together that has not been pushed upstream yet. Changes can also exist locally on a manifest that is behind head, meaning not requiring rebase to latest. Tested using: $ cd .repo/manifests/ $ git checkout <any hash 1> $ <do local modifications> $ repo sync --no-manifest-update $ git checkout <any hash 2> $ repo sync --no-manifest-update Change-Id: I0c9773aa8bc5876813a2e7d7fec697abcb2d9e94 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/246445 Tested-by: Fredrik de Groot <fredrik.de.groot@volvocars.com> Reviewed-by: Mike Frysinger <vapier@google.com>
* sync: merge project updates with status barMike Frysinger2019-11-121-11/+4
| | | | | | | | | | | | | | 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: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* sync: report list of failing git treesVadim Bendebury2019-11-121-2/+11
| | | | | | | | | | | | | | | | | | 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: Vadim Bendebury <vbendeb@google.com> Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/244053 Reviewed-by: Mike Frysinger <vapier@google.com>
* use open context managers in more placesMike Frysinger2019-11-121-20/+5
| | | | | | | | | | 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: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* sync: create dedicated manifest project update funcMike Frysinger2019-09-191-24/+28
| | | | | | | | | | | Cut out some more standalone code from Execute to make this func a bit more manageable. The manifest project update is pretty simple and standalone, but still takes up a good chunk of what's left. Change-Id: Idc2442d9def495eccd0a49cda203c44aef16f129 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/236614 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: David Pursehouse <dpursehouse@collab.net>
* sync: create dedicated smart sync funcMike Frysinger2019-09-111-96/+100
| | | | | | | | | | | | The smart sync logic takes up about 45% of the overall Execute func and is about 100 lines of code. The only effect it has on the rest of the code is to set the manifest_name variable. Since this func is already quite huge, split the smart sync logic out. Change-Id: Id861849b0011ab47387d74e92c2ac15afcc938ba Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/234835 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: David Pursehouse <dpursehouse@collab.net>
* sync: fix deprecated command line option -fv1.13.5.1Stefan Müller-Klieser2019-08-301-0/+1
| | | | | | | | | | | | | | | | | In commit d9e5cf0e ("sync: invert --force-broken with --fail-fast") the force-broken option has been deprecated. Accidentally the option has been changed from Boolean to Value. This breaks all users of repo with: main.py: error: -f option requires an argument This is easy to avoid by keeping the type. Signed-off-by: Stefan Müller-Klieser <s.mueller-klieser@phytec.de> Change-Id: Ia8b589cf41ac756d10c61e17ec8d76ba8f7031f9 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/235043 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* split out cli validation from executionv1.13.5Mike Frysinger2019-08-281-20/+14
| | | | | | | | | | | | | | | | | | | 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: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* sync: invert --force-broken with --fail-fastMike Frysinger2019-08-271-12/+14
| | | | | | | | | | | | | | | | | People seem to not expect the sync process to halt immediately if an error is encountered. It's also basically guaranteed to leave their tree in an incomplete state. Lets invert the default behavior so we attempt to sync (both fetch & checkout) all projects. If an error is hit, we still exit(1) and show it at the end. If people want the sync to abort quickly, they can use the new option --fail-fast. Bug: https://crbug.com/gerrit/11293 Change-Id: I49dd6c4dc8fd5cce8aa905ee169ff3cbe230eb3d Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/234812 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* rebase/sync: use exit(1) for errors instead of exit(-1)Mike Frysinger2019-08-081-4/+4
| | | | | | | | | | | Callers don't actually see -1 (they'll usually see 255, but the exact answer here is complicated). Just switch to 1 as that's the standard value tools use to indicate an error. Change-Id: Ib712db1924bc3e5f7920bafd7bb5fb61f3bda44f Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/233553 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* sync: fix handling of -f and local checkoutsMike Frysinger2019-08-081-3/+1
| | | | | | | | | | | | | The partial clone rework (commit 745be2ede1e67421275afc00c04d996d9d6908ee "Add support for partial clone") changed the behavior when a single repo hit a failure: it would always call sys.exit() immediately. This isn't even necessary as we already pass down an error event object which the workers set and the parent checks. Just delete the exit entirely. Change-Id: Id72d8642aefa2bde24e1a438dbe102c3e3cabf48 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/233552 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* Add support for partial clone.v1.13.4Xin Li2019-07-161-20/+156
| | | | | | | | | | | | | A new option, --partial-clone is added to 'repo init' which tells repo to utilize git's partial clone functionality, which reduces disk and bandwidth usage when downloading by omitting blob downloads initially. Different from restricting clone-depth, the user will have full access to change history, etc., as the objects are downloaded on demand. Change-Id: I60326744875eac16521a007bd7d5481112a98749 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/229532 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Xin Li <delphij@google.com>
* sync: use integer division with job countsMike Frysinger2019-06-141-2/+2
| | | | | | | | Neither of the fields here expect floats so make sure we use integer division when calculating things. Bug: https://crbug.com/gerrit/10418 Change-Id: Ibda068b16a7bba7ff3efba442c4bbff4415caa6e
* set default file encoding to utf-8Mike Frysinger2019-06-131-0/+1
| | | | | | | | There's no reason to support any other encoding in these files. This only affects the files themselves and not streams they open. Bug: https://crbug.com/gerrit/10418 Change-Id: I053cb40cd3666ce5c8a0689b9dd938f24ca765bf
* sync: deleted unused repos in reversed order (children before parent)Kuang-che Wu2019-04-061-1/+2
| | | | | Bug: chromium:950002 Test: repo sync chromeos using release manifest file Change-Id: I613df6a1973eb36acd806a703e72f5172554bcc7
* sync: Add option '--force-remove-dirty'Oleksii Okolielov2019-03-111-3/+17
| | | | | | | | | | Forcefully remove dirty projects if option '--force-remove-dirty' is given. The '--force-remove-dirty' option can be used to remove previously used projects with uncommitted changes. WARNING: This may cause data to be lost since uncommitted changes may be removed with projects that no longer exist in the manifest. Change-Id: I844a6e943ded522fdc7b1b942c0a1269768054bc
* Add support for long pathsRenaud Paquay2018-10-221-13/+13
| | | | | | | | | | | | | | | | | | | | * Add more file i/o wrappers in platform_utils to allow using long paths (length > MAX_PATH) on Windows. * Paths using the long path syntax ("\\?\" prefix) should never escape the platform_utils API surface area, so that this specific syntax is not visible to the rest of the repo code base. * Forward many calls from os.xxx to platform_utils.xxx in various place to ensure long paths support, specifically when repo decides to delete obsolete directories. * There are more places that need to be converted to support long paths, this commit is an initial effort to unblock a few common use cases. * Also, fix remove function to handle directory symlinks Change-Id: If82ccc408e516e96ff7260be25f8fd2fe3f9571a
* update markdown/help header formatMike Frysinger2018-10-101-4/+2
| | | | | | | Since gitiles recommends using # headers over ---/=== underlines, change the manifest-format.md over and all our help texts. Change-Id: I96391d41fba769e9f26870d497cf7cf01c8d8ab3
* Replace all os.remove callsRenaud Paquay2017-08-311-5/+5
| | | | | | | | os.remove raises an exception when deleting read-only files on Windows. Replace all calls with calls to platform_utils.remove, which deals with deals with that issue. Change-Id: I4dc9e0c9a36b4238880520c69f5075eca40f3e66
* Implement islink, readlink and realpath using Win32 apiRenaud Paquay2017-08-311-1/+1
| | | | Change-Id: I18452cbb32d24db73601ad10485dbe6bb278731c
* Merge changes from topic "windows-support"David Pursehouse2017-08-301-2/+2
|\ | | | | | | | | | | | | | | * changes: Port os.rename calls to work on Windows Workaround shutil.rmtree limitation on Windows Add support for creating symbolic links on Windows Make "git command" and "forall" work on Windows
| * Workaround shutil.rmtree limitation on WindowsRenaud Paquay2017-05-291-2/+2
| | | | | | | | | | | | | | | | | | | | By default, shutil.rmtree raises an exception when deleting readonly files on Windows. Replace all shutil.rmtree with platform_utils.rmtree, which adds an error handler to make files read-write when they can't be deleted. Change-Id: I9cfea9a7b3703fb16a82cf69331540c2c179ed53
* | Merge "Always print percentage when syncing quietly"David Pursehouse2017-08-021-1/+2
|\ \