summaryrefslogtreecommitdiffstats
path: root/project.py
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@sonymobile.com>2015-10-14 10:50:15 +0900
committerDavid Pursehouse <david.pursehouse@sonymobile.com>2015-10-27 03:04:17 +0000
commit74cfd2709b0bc23fc3efb8951b4b5abb2bf4e4a7 (patch)
tree3df8296e4e9673893cf5fd7ed77b888e606311bf /project.py
parentc2a64ddffd397f28c1187da1cc07f29825b7d0fb (diff)
downloadgit-repo-74cfd2709b0bc23fc3efb8951b4b5abb2bf4e4a7.tar.gz
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
Diffstat (limited to 'project.py')
-rw-r--r--project.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/project.py b/project.py
index 5d8f61e1..0808af46 100644
--- a/project.py
+++ b/project.py
@@ -1110,7 +1110,8 @@ class Project(object):
1110 clone_bundle=True, 1110 clone_bundle=True,
1111 no_tags=False, 1111 no_tags=False,
1112 archive=False, 1112 archive=False,
1113 optimized_fetch=False): 1113 optimized_fetch=False,
1114 prune=False):
1114 """Perform only the network IO portion of the sync process. 1115 """Perform only the network IO portion of the sync process.
1115 Local working directory/branch state is not affected. 1116 Local working directory/branch state is not affected.
1116 """ 1117 """
@@ -1181,7 +1182,7 @@ class Project(object):
1181 if (need_to_fetch 1182 if (need_to_fetch
1182 and not self._RemoteFetch(initial=is_new, quiet=quiet, alt_dir=alt_dir, 1183 and not self._RemoteFetch(initial=is_new, quiet=quiet, alt_dir=alt_dir,
1183 current_branch_only=current_branch_only, 1184 current_branch_only=current_branch_only,
1184 no_tags=no_tags)): 1185 no_tags=no_tags, prune=prune)):
1185 return False 1186 return False
1186 1187
1187 if self.worktree: 1188 if self.worktree:
@@ -1795,7 +1796,8 @@ class Project(object):
1795 initial=False, 1796 initial=False,
1796 quiet=False, 1797 quiet=False,
1797 alt_dir=None, 1798 alt_dir=None,
1798 no_tags=False): 1799 no_tags=False,
1800 prune=False):
1799 1801
1800 is_sha1 = False 1802 is_sha1 = False
1801 tag_name = None 1803 tag_name = None
@@ -1908,6 +1910,9 @@ class Project(object):
1908 else: 1910 else:
1909 cmd.append('--tags') 1911 cmd.append('--tags')
1910 1912
1913 if prune:
1914 cmd.append('--prune')
1915
1911 spec = [] 1916 spec = []
1912 if not current_branch_only: 1917 if not current_branch_only:
1913 # Fetch whole repo 1918 # Fetch whole repo