diff options
Diffstat (limited to 'subcmds/sync.py')
-rw-r--r-- | subcmds/sync.py | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/subcmds/sync.py b/subcmds/sync.py index f6eb2a08..ec5ada21 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py | |||
@@ -24,6 +24,7 @@ from project import HEAD | |||
24 | from command import Command, MirrorSafeCommand | 24 | from command import Command, MirrorSafeCommand |
25 | from error import RepoChangedException, GitError | 25 | from error import RepoChangedException, GitError |
26 | from project import R_HEADS | 26 | from project import R_HEADS |
27 | from project import SyncBuffer | ||
27 | from progress import Progress | 28 | from progress import Progress |
28 | 29 | ||
29 | class Sync(Command, MirrorSafeCommand): | 30 | class Sync(Command, MirrorSafeCommand): |
@@ -112,7 +113,9 @@ revision is temporarily needed. | |||
112 | return | 113 | return |
113 | 114 | ||
114 | if mp.HasChanges: | 115 | if mp.HasChanges: |
115 | if not mp.Sync_LocalHalf(): | 116 | syncbuf = SyncBuffer(mp.config) |
117 | mp.Sync_LocalHalf(syncbuf) | ||
118 | if not syncbuf.Finish(): | ||
116 | sys.exit(1) | 119 | sys.exit(1) |
117 | 120 | ||
118 | self.manifest._Unload() | 121 | self.manifest._Unload() |
@@ -123,14 +126,17 @@ revision is temporarily needed. | |||
123 | missing.append(project) | 126 | missing.append(project) |
124 | self._Fetch(*missing) | 127 | self._Fetch(*missing) |
125 | 128 | ||
129 | syncbuf = SyncBuffer(mp.config, | ||
130 | detach_head = opt.detach_head) | ||
126 | pm = Progress('Syncing work tree', len(all)) | 131 | pm = Progress('Syncing work tree', len(all)) |
127 | for project in all: | 132 | for project in all: |
128 | pm.update() | 133 | pm.update() |
129 | if project.worktree: | 134 | if project.worktree: |
130 | if not project.Sync_LocalHalf( | 135 | project.Sync_LocalHalf(syncbuf) |
131 | detach_head=opt.detach_head): | ||
132 | sys.exit(1) | ||
133 | pm.end() | 136 | pm.end() |
137 | print >>sys.stderr | ||
138 | if not syncbuf.Finish(): | ||
139 | sys.exit(1) | ||
134 | 140 | ||
135 | 141 | ||
136 | def _PostRepoUpgrade(manifest): | 142 | def _PostRepoUpgrade(manifest): |
@@ -143,7 +149,9 @@ def _PostRepoFetch(rp, no_repo_verify=False, verbose=False): | |||
143 | print >>sys.stderr, 'info: A new version of repo is available' | 149 | print >>sys.stderr, 'info: A new version of repo is available' |
144 | print >>sys.stderr, '' | 150 | print >>sys.stderr, '' |
145 | if no_repo_verify or _VerifyTag(rp): | 151 | if no_repo_verify or _VerifyTag(rp): |
146 | if not rp.Sync_LocalHalf(): | 152 | syncbuf = SyncBuffer(rp.config) |
153 | rp.Sync_LocalHalf(syncbuf) | ||
154 | if not syncbuf.Finish(): | ||
147 | sys.exit(1) | 155 | sys.exit(1) |
148 | print >>sys.stderr, 'info: Restarting repo with latest version' | 156 | print >>sys.stderr, 'info: Restarting repo with latest version' |
149 | raise RepoChangedException(['--repo-upgraded']) | 157 | raise RepoChangedException(['--repo-upgraded']) |