Sync: Add option to prune refs during sync
By passing --prune to the sync command, the --prune option is
given to the `git fetch`, causing refs that no longer exist on
the remote to be removed.
Change-Id: I3cedacce14276d96ac2d5aabf2d07fd05e92bc02
diff --git a/subcmds/sync.py b/subcmds/sync.py
index 2a77065..e865e56 100644
--- a/subcmds/sync.py
+++ b/subcmds/sync.py
@@ -151,6 +151,9 @@
are fixed to a sha1 revision if the sha1 revision does not already
exist locally.
+The --prune option can be used to remove any refs that no longer
+exist on the remote.
+
SSH Connections
---------------
@@ -234,6 +237,8 @@
p.add_option('--optimized-fetch',
dest='optimized_fetch', action='store_true',
help='only fetch projects fixed to sha1 if revision does not exist locally')
+ p.add_option('--prune', dest='prune', action='store_true',
+ help='delete refs that no longer exist on the remote')
if show_smart:
p.add_option('-s', '--smart-sync',
dest='smart_sync', action='store_true',
@@ -305,7 +310,8 @@
force_sync=opt.force_sync,
clone_bundle=not opt.no_clone_bundle,
no_tags=opt.no_tags, archive=self.manifest.IsArchive,
- optimized_fetch=opt.optimized_fetch)
+ optimized_fetch=opt.optimized_fetch,
+ prune=opt.prune)
self._fetch_times.Set(project, time.time() - start)
# Lock around all the rest of the code, since printing, updating a set