diff options
author | Shawn O. Pearce <sop@google.com> | 2009-04-16 11:21:18 -0700 |
---|---|---|
committer | Shawn O. Pearce <sop@google.com> | 2009-04-16 11:21:18 -0700 |
commit | 350cde4c4bec5e7b5776cf52d61da600af3efc31 (patch) | |
tree | 45c09f4113cf5d7c0d5430360344c5d97d93304e /subcmds/sync.py | |
parent | 48244781c2cad1565b4b32b4524ff9931a39f848 (diff) | |
download | git-repo-350cde4c4bec5e7b5776cf52d61da600af3efc31.tar.gz |
Change repo sync to be more friendly when updating the treev1.6.6
We now try to sync all projects that can be done safely first, before
we start rebasing user commits over the upstream. This has the nice
effect of making the local tree as close to the upstream as possible
before the user has to start resolving merge conflicts, as that extra
information in other projects may aid in the conflict resolution.
Informational output is buffered and delayed until calculation for
all projects has been done, so that the user gets one concise list
of notice messages, rather than it interrupting the progress meter.
Fast-forward output is now prefixed with the project header, so the
user can see which project that update is taking place in, and make
some relation of the diffstat back to the project name.
Rebase output is now prefixed with the project header, so that if
the rebase fails, the user can see which project we were operating
on and can try to address the failure themselves.
Since rebase sits on a detached HEAD, we now look for an in-progress
rebase during sync, so we can alert the user that the given project
is in a state we cannot handle.
Signed-off-by: Shawn O. Pearce <sop@google.com>
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']) |