76
89
return self._lookup_revno(self.new_revid)
79
class LocalGitTagDict(tag.BasicTags):
80
"""Dictionary with tags in a local repository."""
92
class GitTags(tag.BasicTags):
93
"""Ref-based tag dictionary."""
82
95
def __init__(self, branch):
83
96
self.branch = branch
84
97
self.repository = branch.repository
99
def get_refs_container(self):
100
raise NotImplementedError(self.get_refs_container)
102
def _iter_tag_refs(self, refs):
103
"""Iterate over the tag refs.
105
:param refs: Refs dictionary (name -> git sha1)
106
:return: iterator over (name, peeled_sha1, unpeeled_sha1, bzr_revid)
108
for k, unpeeled in refs.as_dict().iteritems():
110
tag_name = ref_to_tag_name(k)
111
except (ValueError, UnicodeDecodeError):
113
peeled = refs.get_peeled(k)
115
peeled = self.repository.bzrdir._git.object_store.peel_sha(unpeeled).id
116
yield (tag_name, peeled, unpeeled,
117
self.branch.lookup_foreign_revision_id(peeled))
119
def _merge_to_remote_git(self, target_repo, new_refs, overwrite=False):
122
def get_changed_refs(old_refs):
124
for k, v in new_refs.iteritems():
127
name = ref_to_tag_name(k)
128
if old_refs.get(k) == v:
130
elif overwrite or not k in old_refs:
132
updates[name] = target_repo.lookup_foreign_revision_id(v)
134
conflicts.append((name, v, old_refs[k]))
136
target_repo.bzrdir.send_pack(get_changed_refs, lambda have, want: [])
137
return updates, conflicts
139
def _merge_to_local_git(self, target_repo, refs, overwrite=False):
142
for k, unpeeled in refs.as_dict().iteritems():
145
name = ref_to_tag_name(k)
146
peeled = self.repository.bzrdir.get_peeled(k)
147
if target_repo._git.refs.get(k) == unpeeled:
149
elif overwrite or not k in target_repo._git.refs:
150
target_repo._git.refs[k] = unpeeled or peeled
151
updates[name] = target_repo.lookup_foreign_revision_id(peeled)
153
conflicts.append((name, peeled, target_repo._git.refs[k]))
154
return updates, conflicts
156
def _merge_to_git(self, to_tags, refs, overwrite=False):
157
target_repo = to_tags.repository
158
if self.repository.has_same_location(target_repo):
160
if getattr(target_repo, "_git", None):
161
return self._merge_to_local_git(target_repo, refs, overwrite)
163
return self._merge_to_remote_git(target_repo, refs, overwrite)
165
def _merge_to_non_git(self, to_tags, refs, overwrite=False):
166
unpeeled_map = defaultdict(set)
169
result = dict(to_tags.get_tag_dict())
170
for n, peeled, unpeeled, bzr_revid in self._iter_tag_refs(refs):
171
if unpeeled is not None:
172
unpeeled_map[peeled].add(unpeeled)
173
if result.get(n) == bzr_revid:
175
elif n not in result or overwrite:
176
result[n] = bzr_revid
177
updates[n] = bzr_revid
179
conflicts.append((n, result[n], bzr_revid))
180
to_tags._set_tag_dict(result)
181
if len(unpeeled_map) > 0:
182
map_file = UnpeelMap.from_repository(to_tags.branch.repository)
183
map_file.update(unpeeled_map)
184
map_file.save_in_repository(to_tags.branch.repository)
185
return updates, conflicts
187
def merge_to(self, to_tags, overwrite=False, ignore_master=False,
189
"""See Tags.merge_to."""
190
if source_refs is None:
191
source_refs = self.get_refs_container()
194
if isinstance(to_tags, GitTags):
195
return self._merge_to_git(to_tags, source_refs,
201
master = to_tags.branch.get_master_branch()
202
updates, conflicts = self._merge_to_non_git(to_tags, source_refs,
204
if master is not None:
205
extra_updates, extra_conflicts = self.merge_to(
206
master.tags, overwrite=overwrite,
207
source_refs=source_refs,
208
ignore_master=ignore_master)
209
updates.update(extra_updates)
210
conflicts += extra_conflicts
211
return updates, conflicts
86
213
def get_tag_dict(self):
88
for k,v in extract_tags(self.repository._git.get_refs()).iteritems():
90
obj = self.repository._git[v]
92
mutter("Tag %s points at unknown object %s, ignoring", v, obj)
94
while isinstance(obj, Tag):
96
obj = self.repository._git[v]
97
if not isinstance(obj, Commit):
98
mutter("Tag %s points at object %r that is not a commit, "
101
ret[k] = self.branch.lookup_foreign_revision_id(v)
215
refs = self.get_refs_container()
216
for (name, peeled, unpeeled, bzr_revid) in self._iter_tag_refs(refs):
217
ret[name] = bzr_revid
221
class LocalGitTagDict(GitTags):
222
"""Dictionary with tags in a local repository."""
224
def __init__(self, branch):
225
super(LocalGitTagDict, self).__init__(branch)
226
self.refs = self.repository.bzrdir._git.refs
228
def get_refs_container(self):
104
231
def _set_tag_dict(self, to_dict):
105
extra = set(self.repository._git.get_refs().keys())
232
extra = set(self.refs.allkeys())
106
233
for k, revid in to_dict.iteritems():
107
234
name = tag_name_to_ref(k)
108
235
if name in extra:
109
236
extra.remove(name)
110
237
self.set_tag(k, revid)
111
238
for name in extra:
112
if name.startswith("refs/tags/"):
113
240
del self.repository._git[name]
115
242
def set_tag(self, name, revid):
116
self.repository._git.refs[tag_name_to_ref(name)], _ = \
117
self.branch.lookup_bzr_revision_id(revid)
120
class DictTagDict(LocalGitTagDict):
244
git_sha, mapping = self.branch.lookup_bzr_revision_id(revid)
245
except errors.NoSuchRevision:
246
raise errors.GhostTagsNotSupported(self)
247
self.refs[tag_name_to_ref(name)] = git_sha
250
class DictTagDict(tag.BasicTags):
122
252
def __init__(self, branch, tags):
123
253
super(DictTagDict, self).__init__(branch)
427
683
def _get_branch_formats_to_test():
685
default_format = branch.format_registry.get_default()
686
except AttributeError:
687
default_format = branch.BranchFormat._default_format
689
(GitBranchFormat(), GitBranchFormat()),
690
(GitBranchFormat(), default_format)]
431
693
def _get_interrepo(self, source, target):
432
return repository.InterRepository.get(source.repository,
694
return _mod_repository.InterRepository.get(source.repository, target.repository)
436
697
def is_compatible(cls, source, target):
437
return (isinstance(source, GitBranch) and
438
not isinstance(target, GitBranch) and
439
(getattr(cls._get_interrepo(source, target), "fetch_objects", None) is not None))
441
def _update_revisions(self, stop_revision=None, overwrite=False,
442
graph=None, limit=None):
443
"""Like InterBranch.update_revisions(), but with additions.
445
Compared to the `update_revisions()` below, this function takes a
446
`limit` argument that limits how many git commits will be converted
447
and returns the new git head.
698
if not isinstance(source, GitBranch):
700
if isinstance(target, GitBranch):
701
# InterLocalGitRemoteGitBranch or InterToGitBranch should be used
703
if getattr(cls._get_interrepo(source, target), "fetch_objects", None) is None:
704
# fetch_objects is necessary for this to work
708
def fetch(self, stop_revision=None, fetch_tags=None, limit=None):
709
self.fetch_objects(stop_revision, fetch_tags=fetch_tags, limit=limit)
711
def fetch_objects(self, stop_revision, fetch_tags, limit=None):
449
712
interrepo = self._get_interrepo(self.source, self.target)
713
if fetch_tags is None:
714
c = self.source.get_config()
715
fetch_tags = c.get_user_option_as_bool('branch.fetch_tags')
450
716
def determine_wants(heads):
451
717
if self.source.ref is not None and not self.source.ref in heads:
452
raise NoSuchRef(self.source.ref, heads.keys())
453
if stop_revision is not None:
454
self._last_revid = stop_revision
455
head, mapping = self.source.repository.lookup_bzr_revision_id(
718
raise NoSuchRef(self.source.ref, self.source.user_url, heads.keys())
720
if stop_revision is None:
458
721
if self.source.ref is not None:
459
722
head = heads[self.source.ref]
461
724
head = heads["HEAD"]
462
725
self._last_revid = self.source.lookup_foreign_revision_id(head)
463
if self.target.repository.has_revision(self._last_revid):
727
self._last_revid = stop_revision
728
real = interrepo.get_determine_wants_revids(
729
[self._last_revid], include_tags=fetch_tags)
466
731
pack_hint, head, refs = interrepo.fetch_objects(
467
732
determine_wants, self.source.mapping, limit=limit)
468
733
if (pack_hint is not None and
469
734
self.target.repository._format.pack_compresses):
470
735
self.target.repository.pack(hint=pack_hint)
472
self._last_revid = self.source.lookup_foreign_revision_id(head)
738
def _update_revisions(self, stop_revision=None, overwrite=False):
739
head, refs = self.fetch_objects(stop_revision, fetch_tags=None)
474
741
prev_last_revid = None
476
743
prev_last_revid = self.target.last_revision()
477
744
self.target.generate_revision_history(self._last_revid,
745
prev_last_revid, self.source)
481
def update_revisions(self, stop_revision=None, overwrite=False,
483
"""See InterBranch.update_revisions()."""
484
self._update_revisions(stop_revision, overwrite, graph)
748
def _basic_pull(self, stop_revision, overwrite, run_hooks,
749
_override_hook_target, _hook_master):
750
result = GitBranchPullResult()
751
result.source_branch = self.source
752
if _override_hook_target is None:
753
result.target_branch = self.target
755
result.target_branch = _override_hook_target
756
self.source.lock_read()
758
self.target.lock_write()
760
# We assume that during 'pull' the target repository is closer than
762
(result.old_revno, result.old_revid) = \
763
self.target.last_revision_info()
764
result.new_git_head, remote_refs = self._update_revisions(
765
stop_revision, overwrite=overwrite)
766
tags_ret = self.source.tags.merge_to(
767
self.target.tags, overwrite)
768
if isinstance(tags_ret, tuple):
769
result.tag_updates, result.tag_conflicts = tags_ret
771
result.tag_conflicts = tags_ret
772
(result.new_revno, result.new_revid) = \
773
self.target.last_revision_info()
775
result.master_branch = _hook_master
776
result.local_branch = result.target_branch
778
result.master_branch = result.target_branch
779
result.local_branch = None
781
for hook in branch.Branch.hooks['post_pull']:
486
789
def pull(self, overwrite=False, stop_revision=None,
487
790
possible_transports=None, _hook_master=None, run_hooks=True,
488
_override_hook_target=None, local=False, limit=None):
791
_override_hook_target=None, local=False):
489
792
"""See Branch.pull.
491
794
:param _hook_master: Private parameter - set the branch to
495
798
so it should not run its hooks.
496
799
:param _override_hook_target: Private parameter - set the branch to be
497
800
supplied as the target_branch to pull hooks.
498
:param limit: Only import this many revisons. `None`, the default,
499
means import all revisions.
501
802
# This type of branch can't be bound.
803
bound_location = self.target.get_bound_location()
804
if local and not bound_location:
503
805
raise errors.LocalRequiresBoundBranch()
504
result = GitBranchPullResult()
505
result.source_branch = self.source
506
if _override_hook_target is None:
507
result.target_branch = self.target
509
result.target_branch = _override_hook_target
807
source_is_master = False
510
808
self.source.lock_read()
810
# bound_location comes from a config file, some care has to be
811
# taken to relate it to source.user_url
812
normalized = urlutils.normalize_url(bound_location)
814
relpath = self.source.user_transport.relpath(normalized)
815
source_is_master = (relpath == '')
816
except (errors.PathNotChild, errors.InvalidURL):
817
source_is_master = False
818
if not local and bound_location and not source_is_master:
819
# not pulling from master, so we need to update master.
820
master_branch = self.target.get_master_branch(possible_transports)
821
master_branch.lock_write()
512
# We assume that during 'pull' the target repository is closer than
514
graph = self.target.repository.get_graph(self.source.repository)
515
(result.old_revno, result.old_revid) = \
516
self.target.last_revision_info()
517
result.new_git_head = self._update_revisions(
518
stop_revision, overwrite=overwrite, graph=graph, limit=limit)
519
result.tag_conflicts = self.source.tags.merge_to(self.target.tags,
521
(result.new_revno, result.new_revid) = \
522
self.target.last_revision_info()
524
result.master_branch = _hook_master
525
result.local_branch = result.target_branch
527
result.master_branch = result.target_branch
528
result.local_branch = None
530
for hook in branch.Branch.hooks['post_pull']:
825
# pull from source into master.
826
master_branch.pull(self.source, overwrite, stop_revision,
828
result = self._basic_pull(stop_revision, overwrite, run_hooks,
829
_override_hook_target, _hook_master=master_branch)
834
master_branch.unlock()
536
837
def _basic_push(self, overwrite=False, stop_revision=None):
537
838
result = branch.BranchPushResult()
538
839
result.source_branch = self.source
539
840
result.target_branch = self.target
540
graph = self.target.repository.get_graph(self.source.repository)
541
841
result.old_revno, result.old_revid = self.target.last_revision_info()
542
result.new_git_head = self._update_revisions(
543
stop_revision, overwrite=overwrite, graph=graph)
544
result.tag_conflicts = self.source.tags.merge_to(self.target.tags,
842
result.new_git_head, remote_refs = self._update_revisions(
843
stop_revision, overwrite=overwrite)
844
tags_ret = self.source.tags.merge_to(self.target.tags,
846
if isinstance(tags_ret, tuple):
847
(result.tag_updates, result.tag_conflicts) = tags_ret
849
result.tag_conflicts = tags_ret
546
850
result.new_revno, result.new_revid = self.target.last_revision_info()
587
class InterGitRemoteLocalBranch(InterGitBranch):
895
class InterGitLocalGitBranch(InterGitBranch):
588
896
"""InterBranch that copies from a remote to a local git branch."""
591
899
def _get_branch_formats_to_test():
595
904
def is_compatible(self, source, target):
596
from bzrlib.plugins.git.remote import RemoteGitBranch
597
return (isinstance(source, RemoteGitBranch) and
905
return (isinstance(source, GitBranch) and
598
906
isinstance(target, LocalGitBranch))
600
908
def _basic_push(self, overwrite=False, stop_revision=None):
601
result = branch.BranchPushResult()
909
result = GitBranchPushResult()
602
910
result.source_branch = self.source
603
911
result.target_branch = self.target
604
912
result.old_revid = self.target.last_revision()
605
913
refs, stop_revision = self.update_refs(stop_revision)
606
914
self.target.generate_revision_history(stop_revision, result.old_revid)
607
self.update_tags(refs)
915
tags_ret = self.source.tags.merge_to(self.target.tags,
916
source_refs=refs, overwrite=overwrite)
917
if isinstance(tags_ret, tuple):
918
(result.tag_updates, result.tag_conflicts) = tags_ret
920
result.tag_conflicts = tags_ret
608
921
result.new_revid = self.target.last_revision()
611
def update_tags(self, refs):
612
for name, v in extract_tags(refs).iteritems():
613
revid = self.target.lookup_foreign_revision_id(v)
614
self.target.tags.set_tag(name, revid)
616
924
def update_refs(self, stop_revision=None):
617
interrepo = repository.InterRepository.get(self.source.repository,
925
interrepo = _mod_repository.InterRepository.get(self.source.repository,
618
926
self.target.repository)
619
927
if stop_revision is None:
620
928
refs = interrepo.fetch(branches=["HEAD"])
631
939
result = GitPullResult()
632
940
result.source_branch = self.source
633
941
result.target_branch = self.target
634
result.old_revid = self.target.last_revision()
635
refs, stop_revision = self.update_refs(stop_revision)
636
self.target.generate_revision_history(stop_revision, result.old_revid)
637
self.update_tags(refs)
638
result.new_revid = self.target.last_revision()
942
self.source.lock_read()
944
self.target.lock_write()
946
result.old_revid = self.target.last_revision()
947
refs, stop_revision = self.update_refs(stop_revision)
948
self.target.generate_revision_history(stop_revision, result.old_revid)
949
tags_ret = self.source.tags.merge_to(self.target.tags,
950
overwrite=overwrite, source_refs=refs)
951
if isinstance(tags_ret, tuple):
952
(result.tag_updates, result.tag_conflicts) = tags_ret
954
result.tag_conflicts = tags_ret
955
result.new_revid = self.target.last_revision()
956
result.local_branch = None
957
result.master_branch = result.target_branch
959
for hook in branch.Branch.hooks['post_pull']:
642
968
class InterToGitBranch(branch.GenericInterBranch):
643
"""InterBranch implementation that pulls from Git into bzr."""
969
"""InterBranch implementation that pulls into a Git branch."""
645
971
def __init__(self, source, target):
646
972
super(InterToGitBranch, self).__init__(source, target)
647
self.interrepo = repository.InterRepository.get(source.repository,
973
self.interrepo = _mod_repository.InterRepository.get(source.repository,
648
974
target.repository)
651
977
def _get_branch_formats_to_test():
979
default_format = branch.format_registry.get_default()
980
except AttributeError:
981
default_format = branch.BranchFormat._default_format
982
return [(default_format, GitBranchFormat())]
655
985
def is_compatible(self, source, target):
656
986
return (not isinstance(source, GitBranch) and
657
987
isinstance(target, GitBranch))
659
def update_revisions(self, *args, **kwargs):
660
raise NoPushSupport()
662
def _get_new_refs(self, stop_revision=None):
989
def _get_new_refs(self, stop_revision=None, fetch_tags=None):
990
assert self.source.is_locked()
663
991
if stop_revision is None:
664
stop_revision = self.source.last_revision()
992
(stop_revno, stop_revision) = self.source.last_revision_info()
994
stop_revno = self.source.revision_id_to_revno(stop_revision)
665
995
assert type(stop_revision) is str
666
996
main_ref = self.target.ref or "refs/heads/master"
667
997
refs = { main_ref: (None, stop_revision) }
998
if fetch_tags is None:
999
c = self.source.get_config()
1000
fetch_tags = c.get_user_option_as_bool('branch.fetch_tags')
668
1001
for name, revid in self.source.tags.get_tag_dict().iteritems():
669
1002
if self.source.repository.has_revision(revid):
670
refs[tag_name_to_ref(name)] = (None, revid)
671
return refs, main_ref
1003
ref = tag_name_to_ref(name)
1004
if not check_ref_format(ref):
1005
warning("skipping tag with invalid characters %s (%s)",
1009
# FIXME: Skip tags that are not in the ancestry
1010
refs[ref] = (None, revid)
1011
return refs, main_ref, (stop_revno, stop_revision)
1013
def _update_refs(self, result, old_refs, new_refs, overwrite):
1014
mutter("updating refs. old refs: %r, new refs: %r",
1016
result.tag_updates = {}
1017
result.tag_conflicts = []
1018
ret = dict(old_refs)
1019
def ref_equals(refs, ref, git_sha, revid):
1024
if (value[0] is not None and
1025
git_sha is not None and
1026
value[0] == git_sha):
1028
if (value[1] is not None and
1029
revid is not None and
1032
# FIXME: If one side only has the git sha available and the other only
1033
# has the bzr revid, then this will cause us to show a tag as updated
1034
# that hasn't actually been updated.
1036
# FIXME: Check for diverged branches
1037
for ref, (git_sha, revid) in new_refs.iteritems():
1038
if ref_equals(ret, ref, git_sha, revid):
1039
# Already up to date
1041
git_sha = old_refs[ref][0]
1043
revid = old_refs[ref][1]
1044
ret[ref] = new_refs[ref] = (git_sha, revid)
1045
elif ref not in ret or overwrite:
1047
tag_name = ref_to_tag_name(ref)
1051
result.tag_updates[tag_name] = revid
1052
ret[ref] = (git_sha, revid)
1054
# FIXME: Check diverged
1058
name = ref_to_tag_name(ref)
1062
result.tag_conflicts.append((name, revid, ret[name][1]))
1064
ret[ref] = (git_sha, revid)
1067
def fetch(self, stop_revision=None, fetch_tags=None, lossy=False, limit=None):
1068
assert limit is None
1069
if stop_revision is None:
1070
stop_revision = self.source.last_revision()
1073
for k, v in self.source.tags.get_tag_dict().iteritems():
1074
ret.append((None, v))
1075
ret.append((None, stop_revision))
1076
self.interrepo.fetch_objects(ret, lossy=lossy)
673
1078
def pull(self, overwrite=False, stop_revision=None, local=False,
674
possible_transports=None):
675
from dulwich.protocol import ZERO_SHA
1079
possible_transports=None, run_hooks=True):
676
1080
result = GitBranchPullResult()
677
1081
result.source_branch = self.source
678
1082
result.target_branch = self.target
679
new_refs, main_ref = self._get_new_refs(stop_revision)
680
def update_refs(old_refs):
681
refs = dict(old_refs)
682
# FIXME: Check for diverged branches
683
refs.update(new_refs)
685
old_refs, new_refs = self.interrepo.fetch_refs(update_refs)
686
result.old_revid = self.target.lookup_foreign_revision_id(
687
old_refs.get(main_ref, ZERO_SHA))
688
result.new_revid = new_refs[main_ref]
1083
self.source.lock_read()
1085
self.target.lock_write()
1087
new_refs, main_ref, stop_revinfo = self._get_new_refs(
1089
def update_refs(old_refs):
1090
return self._update_refs(result, old_refs, new_refs, overwrite)
1092
result.revidmap, old_refs, new_refs = self.interrepo.fetch_refs(
1093
update_refs, lossy=False)
1094
except NoPushSupport:
1095
raise errors.NoRoundtrippingSupport(self.source, self.target)
1096
(old_sha1, result.old_revid) = old_refs.get(main_ref, (ZERO_SHA, NULL_REVISION))
1097
if result.old_revid is None:
1098
result.old_revid = self.target.lookup_foreign_revision_id(old_sha1)
1099
result.new_revid = new_refs[main_ref][1]
1100
result.local_branch = None
1101
result.master_branch = self.target
1103
for hook in branch.Branch.hooks['post_pull']:
1106
self.target.unlock()
1108
self.source.unlock()
691
def push(self, overwrite=False, stop_revision=None,
1111
def push(self, overwrite=False, stop_revision=None, lossy=False,
692
1112
_override_hook_source_branch=None):
693
from dulwich.protocol import ZERO_SHA
694
1113
result = GitBranchPushResult()
695
1114
result.source_branch = self.source
696
1115
result.target_branch = self.target
697
new_refs, main_ref = self._get_new_refs(stop_revision)
698
def update_refs(old_refs):
699
refs = dict(old_refs)
700
# FIXME: Check for diverged branches
701
refs.update(new_refs)
703
old_refs, new_refs = self.interrepo.fetch_refs(update_refs)
704
(result.old_revid, old_sha1) = old_refs.get(main_ref, (ZERO_SHA, NULL_REVISION))
705
if result.old_revid is None:
706
result.old_revid = self.target.lookup_foreign_revision_id(old_sha1)
707
result.new_revid = new_refs[main_ref]
1116
result.local_branch = None
1117
result.master_branch = result.target_branch
1118
self.source.lock_read()
1120
new_refs, main_ref, stop_revinfo = self._get_new_refs(stop_revision)
1121
def update_refs(old_refs):
1122
return self._update_refs(result, old_refs, new_refs, overwrite)
1124
result.revidmap, old_refs, new_refs = self.interrepo.fetch_refs(
1125
update_refs, lossy=lossy)
1126
except NoPushSupport:
1127
raise errors.NoRoundtrippingSupport(self.source, self.target)
1128
(old_sha1, result.old_revid) = old_refs.get(main_ref, (ZERO_SHA, NULL_REVISION))
1129
if result.old_revid is None:
1130
result.old_revid = self.target.lookup_foreign_revision_id(old_sha1)
1131
result.new_revid = new_refs[main_ref][1]
1132
(result.new_original_revno, result.new_original_revid) = stop_revinfo
1133
for hook in branch.Branch.hooks['post_push']:
1136
self.source.unlock()
710
1139
def lossy_push(self, stop_revision=None):
711
result = GitBranchPushResult()
712
result.source_branch = self.source
713
result.target_branch = self.target
714
new_refs, main_ref = self._get_new_refs(stop_revision)
715
def update_refs(old_refs):
716
refs = dict(old_refs)
717
# FIXME: Check for diverged branches
718
refs.update(new_refs)
720
result.revidmap, old_refs, new_refs = self.interrepo.dfetch_refs(
722
result.old_revid = old_refs.get(self.target.ref, (None, NULL_REVISION))[1]
723
result.new_revid = new_refs[main_ref][1]
727
branch.InterBranch.register_optimiser(InterGitRemoteLocalBranch)
1140
# For compatibility with bzr < 2.4
1141
return self.push(lossy=True, stop_revision=stop_revision)
1144
branch.InterBranch.register_optimiser(InterGitLocalGitBranch)
728
1145
branch.InterBranch.register_optimiser(InterFromGitBranch)
729
1146
branch.InterBranch.register_optimiser(InterToGitBranch)
730
branch.InterBranch.register_optimiser(InterGitLocalRemoteBranch)
1147
branch.InterBranch.register_optimiser(InterLocalGitRemoteGitBranch)