/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/git/branch.py

  • Committer: Jelmer Vernooij
  • Date: 2020-05-24 00:39:50 UTC
  • mto: This revision was merged to the branch mainline in revision 7504.
  • Revision ID: jelmer@jelmer.uk-20200524003950-bbc545r76vc5yajg
Add github action.

Show diffs side-by-side

added added

removed removed

Lines of Context:
59
59
    warning,
60
60
    )
61
61
 
 
62
from .config import (
 
63
    GitBranchConfig,
 
64
    GitBranchStack,
 
65
    )
62
66
from .errors import (
63
67
    NoPushSupport,
64
68
    )
65
 
from .mapping import (
66
 
    encode_git_path,
67
 
    decode_git_path,
68
 
    )
69
69
from .push import (
70
70
    remote_divergence,
71
71
    )
132
132
        updates = {}
133
133
        conflicts = []
134
134
        source_tag_refs = self.source.branch.get_tag_refs()
135
 
        ref_to_tag_map = {}
136
135
 
137
136
        def get_changed_refs(old_refs):
138
137
            ret = dict(old_refs)
146
145
                    ret[ref_name] = unpeeled
147
146
                    updates[tag_name] = self.target.branch.repository.lookup_foreign_revision_id(
148
147
                        peeled)
149
 
                    ref_to_tag_map[ref_name] = tag_name
150
148
                    self.target.branch._tag_refs = None
151
149
                else:
152
150
                    conflicts.append(
155
153
                         self.target.branch.repository.lookup_foreign_revision_id(
156
154
                             old_refs[ref_name])))
157
155
            return ret
158
 
        result = self.target.branch.repository.controldir.send_pack(
 
156
        self.target.branch.repository.controldir.send_pack(
159
157
            get_changed_refs, lambda have, want: [])
160
 
        if result is not None and not isinstance(result, dict):
161
 
            for ref, error in result.ref_status.items():
162
 
                if error:
163
 
                    warning('unable to update ref %s: %s',
164
 
                            ref, error)
165
 
                    del updates[ref_to_tag_map[ref]]
166
158
        return updates, set(conflicts)
167
159
 
168
160
 
482
474
        return "git"
483
475
 
484
476
    def get_config(self):
485
 
        from .config import GitBranchConfig
486
477
        return GitBranchConfig(self)
487
478
 
488
479
    def get_config_stack(self):
489
 
        from .config import GitBranchStack
490
480
        return GitBranchStack(self)
491
481
 
492
482
    def _get_nick(self, local=False, possible_master_transports=None):
498
488
            cs = self.repository._git.get_config_stack()
499
489
            try:
500
490
                return cs.get((b"branch", self.name.encode('utf-8')),
501
 
                        b"nick").decode("utf-8")
 
491
                              b"nick").decode("utf-8")
502
492
            except KeyError:
503
493
                pass
504
494
        return self.name or u"HEAD"
1043
1033
                for path, url, section in parse_submodules(
1044
1034
                        GitConfigFile.from_file(f)):
1045
1035
                    self.target.set_reference_info(
1046
 
                        tree.path2id(decode_git_path(path)), url.decode('utf-8'),
1047
 
                        decode_git_path(path))
 
1036
                        tree.path2id(path.decode('utf-8')), url.decode('utf-8'),
 
1037
                        path.decode('utf-8'))
1048
1038
        except errors.NoSuchFile:
1049
1039
            pass
1050
1040
 
1175
1165
                isinstance(target, RemoteGitBranch))
1176
1166
 
1177
1167
    def _basic_push(self, overwrite, stop_revision, tag_selector=None):
1178
 
        from .remote import parse_git_error
1179
1168
        result = GitBranchPushResult()
1180
1169
        result.source_branch = self.source
1181
1170
        result.target_branch = self.target
1207
1196
                    continue
1208
1197
                refs[tag_name_to_ref(name)] = sha
1209
1198
            return refs
1210
 
        dw_result = self.target.repository.send_pack(
 
1199
        self.target.repository.send_pack(
1211
1200
            get_changed_refs,
1212
1201
            self.source.repository._git.generate_pack_data)
1213
 
        if dw_result is not None and not isinstance(dw_result, dict):
1214
 
            error = dw_result.ref_status.get(self.target.ref)
1215
 
            if error:
1216
 
                raise parse_git_error(self.target.user_url, error)
1217
 
            for ref, error in dw_result.ref_status.items():
1218
 
                if error:
1219
 
                    trace.warning('unable to open ref %s: %s', ref, error)
1220
1202
        return result
1221
1203
 
1222
1204
 
1388
1370
               old_refs, new_refs)
1389
1371
        result.tag_updates = {}
1390
1372
        result.tag_conflicts = []
1391
 
        ret = {}
 
1373
        ret = dict(old_refs)
1392
1374
 
1393
1375
        def ref_equals(refs, ref, git_sha, revid):
1394
1376
            try: