/breezy-svn/trunk

To get this branch, use:
bzr branch https://code.breezy-vcs.org/breezy-svn/trunk

« back to all changes in this revision

Viewing changes to push.py

  • Committer: Jelmer Vernooij
  • Date: 2020-01-31 19:40:01 UTC
  • Revision ID: jelmer@jelmer.uk-20200131194001-ri4z8wyq0cvymo20
More python3/breezy compat fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
from breezy.sixish import (
50
50
    text_type,
51
51
    )
52
 
from breezy.testament import (
 
52
from breezy.bzr.testament import (
53
53
    StrictTestament,
54
54
    )
55
55
from breezy.trace import (
105
105
    :return: A generator of changes.
106
106
    """
107
107
    for change in iter_changes:
108
 
        kind = change[6][1]
109
 
        versioned = change[3][1]
 
108
        kind = change.kind[1]
 
109
        versioned = change.versioned[1]
110
110
        if kind is None and versioned:
111
111
            # 'missing' path
112
112
            # Reset the new path (None) and new versioned flag (False)
113
 
            change = (change[0], (change[1][0], None), change[2],
114
 
                (change[3][0], False)) + change[4:]
115
 
        if change[3][0] or change[3][1]:
 
113
            change = TreeChange(
 
114
                change.file_id, (change.path[0], None),
 
115
                change.changed_content,
 
116
                (change.versioned[0], False), *change[4:])
 
117
        if any(change.versioned):
116
118
            yield change
117
119
 
118
120
 
119
 
def push_revision_tree(graph, target_repo, branch_path, config_stack, source_repo,
120
 
                       base_revid, revision_id, rev,
121
 
                       base_foreign_revid, base_mapping,
122
 
                       push_metadata,
 
121
def push_revision_tree(graph, target_repo, branch_path, config_stack,
 
122
                       source_repo, base_revid, revision_id, rev,
 
123
                       base_foreign_revid, base_mapping, push_metadata,
123
124
                       root_action):
124
125
    """Push a revision tree into a target repository.
125
126
 
175
176
        builder.will_record_deletes()
176
177
        iter_changes = old_tree.iter_changes(base_tree)
177
178
        iter_changes = _filter_iter_changes(iter_changes)
178
 
        for file_id, path, fs_hash in builder.record_iter_changes(
179
 
            old_tree, base_tree.get_revision_id(), iter_changes):
 
179
        for path, fs_hash in builder.record_iter_changes(
 
180
                old_tree, base_tree.get_revision_id(), iter_changes):
180
181
            pass
181
182
        builder.finish_inventory()
182
 
    except:
 
183
    except BaseException:
183
184
        builder.abort()
184
185
        raise
185
186
    try:
186
187
        revid = builder.commit(rev.message)
187
 
    except SubversionException, (msg, num):
 
188
    except SubversionException as e:
188
189
        builder.abort()
189
 
        if num == ERR_FS_TXN_OUT_OF_DATE:
 
190
        if e.args[1] == ERR_FS_TXN_OUT_OF_DATE:
190
191
            raise DivergedBranches(source_repo, target_repo)
191
192
        raise
192
193
    except ChangesRootLHSHistory:
552
553
                    rev, push_metadata=push_metadata,
553
554
                    base_foreign_info=start_parent_foreign_info,
554
555
                    root_action=("create", ))
555
 
        except SubversionException, (msg, num):
556
 
            if num == subvertpy.ERR_FS_TXN_OUT_OF_DATE:
 
556
        except SubversionException as e:
 
557
            if e.args[1] == subvertpy.ERR_FS_TXN_OUT_OF_DATE:
557
558
                raise AlreadyBranchError(target_branch_path)
558
559
            raise
559
560
 
765
766
            if deletefirst:
766
767
                try:
767
768
                    root.delete_entry(urlutils.basename(branch_path))
768
 
                except SubversionException, (msg, num):
769
 
                    if num == ERR_FS_ROOT_DIR:
 
769
                except SubversionException as e:
 
770
                    if e.args[1] == ERR_FS_ROOT_DIR:
770
771
                        raise ChangesRootLHSHistory()
771
772
                    raise
772
773
            branch_dir = root.add_directory(