Merge lp:~jelmer/brz/git-local-remote-interrep into lp:brz/3.1

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: no longer in the source branch.
Merge reported by: The Breezy Bot
Merged at revision: not available
Proposed branch: lp:~jelmer/brz/git-local-remote-interrep
Merge into: lp:brz/3.1
Diff against target: 52 lines (+34/-0)
2 files modified
breezy/git/interrepo.py (+33/-0)
breezy/git/repository.py (+1/-0)
To merge this branch: bzr merge lp:~jelmer/brz/git-local-remote-interrep
Reviewer Review Type Date Requested Status
Jelmer Vernooij Approve
Review via email: mp+393676@code.launchpad.net

Commit message

Add InterLocalGitRemoteGitRepository.

Description of the change

Add InterLocalGitRemoteGitRepository.

To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) :
review: Approve
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'breezy/git/interrepo.py'
2--- breezy/git/interrepo.py 2020-07-18 15:20:23 +0000
3+++ breezy/git/interrepo.py 2020-11-13 02:03:06 +0000
4@@ -794,3 +794,36 @@
5 """Be compatible with GitRepository."""
6 return (isinstance(source, RemoteGitRepository) and
7 isinstance(target, LocalGitRepository))
8+
9+
10+
11+class InterLocalGitRemoteGitRepository(InterToGitRepository):
12+
13+ def fetch_refs(self, update_refs, lossy=False, overwrite=False):
14+ """Import the gist of the ancestry of a particular revision."""
15+ if lossy:
16+ raise LossyPushToSameVCS(self.source, self.target)
17+
18+ def git_update_refs(old_refs):
19+ ret = {}
20+ self.old_refs = {
21+ k: (v, None) for (k, v) in viewitems(old_refs)}
22+ new_refs = update_refs(self.old_refs)
23+ for name, (gitid, revid) in viewitems(new_refs):
24+ if gitid is None:
25+ gitid = self.source_store._lookup_revision_sha1(revid)
26+ if not overwrite:
27+ if remote_divergence(
28+ old_refs.get(name), gitid, self.source_store):
29+ raise DivergedBranches(self.source, self.target)
30+ ret[name] = gitid
31+ return ret
32+ new_refs = self.target.send_pack(
33+ git_update_refs,
34+ self.source._git.generate_pack_data)
35+ return None, self.old_refs, new_refs
36+
37+ @staticmethod
38+ def is_compatible(source, target):
39+ return (isinstance(source, LocalGitRepository) and
40+ isinstance(target, RemoteGitRepository))
41
42=== modified file 'breezy/git/repository.py'
43--- breezy/git/repository.py 2020-06-28 19:19:25 +0000
44+++ breezy/git/repository.py 2020-11-13 02:03:06 +0000
45@@ -107,6 +107,7 @@
46 for optimiser in ['InterRemoteGitNonGitRepository',
47 'InterLocalGitNonGitRepository',
48 'InterLocalGitLocalGitRepository',
49+ 'InterLocalGitRemoteGitRepository',
50 'InterRemoteGitLocalGitRepository',
51 'InterToLocalGitRepository',
52 'InterToRemoteGitRepository',

Subscribers

People subscribed via source and target branches