Merge lp:~jelmer/brz/git-present-only into lp:brz

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-present-only
Merge into: lp:brz
Diff against target: 118 lines (+33/-36)
2 files modified
breezy/git/branch.py (+30/-36)
doc/en/release-notes/brz-3.1.txt (+3/-0)
To merge this branch: bzr merge lp:~jelmer/brz/git-present-only
Reviewer Review Type Date Requested Status
Jelmer Vernooij Approve
Review via email: mp+377144@code.launchpad.net

Commit message

Ignore ghost tags when interacting with remote Git repositories.

Description of the change

Ignore ghost tags when interacting with remote Git repositories.

To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'breezy/git/branch.py'
--- breezy/git/branch.py 2019-10-20 02:08:44 +0000
+++ breezy/git/branch.py 2020-01-02 11:41:46 +0000
@@ -30,6 +30,7 @@
3030
31from .. import (31from .. import (
32 branch,32 branch,
33 cleanup,
33 config,34 config,
34 controldir,35 controldir,
35 errors,36 errors,
@@ -235,9 +236,9 @@
235 master = None236 master = None
236 else:237 else:
237 master = to_tags.branch.get_master_branch()238 master = to_tags.branch.get_master_branch()
238 if master is not None:239 with cleanup.ExitStack() as es:
239 master.lock_write()240 if master is not None:
240 try:241 es.enter_context(master.lock_write())
241 updates, conflicts = self._merge_to_non_git(242 updates, conflicts = self._merge_to_non_git(
242 to_tags, source_tag_refs, overwrite=overwrite)243 to_tags, source_tag_refs, overwrite=overwrite)
243 if master is not None:244 if master is not None:
@@ -248,9 +249,6 @@
248 updates.update(extra_updates)249 updates.update(extra_updates)
249 conflicts += extra_conflicts250 conflicts += extra_conflicts
250 return updates, conflicts251 return updates, conflicts
251 finally:
252 if master is not None:
253 master.unlock()
254252
255 def get_tag_dict(self):253 def get_tag_dict(self):
256 ret = {}254 ret = {}
@@ -1038,37 +1036,30 @@
1038 bound_location = self.target.get_bound_location()1036 bound_location = self.target.get_bound_location()
1039 if local and not bound_location:1037 if local and not bound_location:
1040 raise errors.LocalRequiresBoundBranch()1038 raise errors.LocalRequiresBoundBranch()
1041 master_branch = None
1042 source_is_master = False1039 source_is_master = False
1043 self.source.lock_read()1040 with cleanup.ExitStack() as es:
1044 if bound_location:1041 es.enter_context(self.source.lock_read())
1045 # bound_location comes from a config file, some care has to be1042 if bound_location:
1046 # taken to relate it to source.user_url1043 # bound_location comes from a config file, some care has to be
1047 normalized = urlutils.normalize_url(bound_location)1044 # taken to relate it to source.user_url
1048 try:1045 normalized = urlutils.normalize_url(bound_location)
1049 relpath = self.source.user_transport.relpath(normalized)1046 try:
1050 source_is_master = (relpath == '')1047 relpath = self.source.user_transport.relpath(normalized)
1051 except (errors.PathNotChild, urlutils.InvalidURL):1048 source_is_master = (relpath == '')
1052 source_is_master = False1049 except (errors.PathNotChild, urlutils.InvalidURL):
1053 if not local and bound_location and not source_is_master:1050 source_is_master = False
1054 # not pulling from master, so we need to update master.1051 if not local and bound_location and not source_is_master:
1055 master_branch = self.target.get_master_branch(possible_transports)1052 # not pulling from master, so we need to update master.
1056 master_branch.lock_write()1053 master_branch = self.target.get_master_branch(possible_transports)
1057 try:1054 es.enter_context(master_branch.lock_write())
1058 try:1055 # pull from source into master.
1059 if master_branch:1056 master_branch.pull(self.source, overwrite, stop_revision,
1060 # pull from source into master.1057 run_hooks=False)
1061 master_branch.pull(self.source, overwrite, stop_revision,1058 else:
1062 run_hooks=False)1059 master_branch = None
1063 result = self._basic_pull(stop_revision, overwrite, run_hooks,1060 return self._basic_pull(stop_revision, overwrite, run_hooks,
1064 _override_hook_target,1061 _override_hook_target,
1065 _hook_master=master_branch)1062 _hook_master=master_branch)
1066 finally:
1067 self.source.unlock()
1068 finally:
1069 if master_branch:
1070 master_branch.unlock()
1071 return result
10721063
1073 def _basic_push(self, overwrite, stop_revision):1064 def _basic_push(self, overwrite, stop_revision):
1074 if overwrite is True:1065 if overwrite is True:
@@ -1135,6 +1126,9 @@
1135 result.new_revid = stop_revision1126 result.new_revid = stop_revision
1136 for name, sha in viewitems(1127 for name, sha in viewitems(
1137 self.source.repository._git.refs.as_dict(b"refs/tags")):1128 self.source.repository._git.refs.as_dict(b"refs/tags")):
1129 if sha not in self.source.repository._git:
1130 trace.mutter('Ignoring missing SHA: %s', sha)
1131 continue
1138 refs[tag_name_to_ref(name)] = sha1132 refs[tag_name_to_ref(name)] = sha
1139 return refs1133 return refs
1140 self.target.repository.send_pack(1134 self.target.repository.send_pack(
11411135
=== modified file 'doc/en/release-notes/brz-3.1.txt'
--- doc/en/release-notes/brz-3.1.txt 2019-12-23 11:22:51 +0000
+++ doc/en/release-notes/brz-3.1.txt 2020-01-02 11:41:46 +0000
@@ -120,6 +120,9 @@
120* Fix ``brz diff --using`` when {old_path} and {new_path} are not120* Fix ``brz diff --using`` when {old_path} and {new_path} are not
121 specified in the template. (#1847915, Jelmer Vernooij)121 specified in the template. (#1847915, Jelmer Vernooij)
122122
123* Ignore ghost tags when interacting with remote Git repositories.
124 (Jelmer Vernooij)
125
123Documentation126Documentation
124*************127*************
125128

Subscribers

People subscribed via source and target branches