/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/plugins/fastimport/idmapfile.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2018-07-04 12:50:55 UTC
  • mfrom: (7027.2.8 git-fixes)
  • Revision ID: breezy.the.bot@gmail.com-20180704125055-8nni25pn2439p48v
Fix eol handling in knits on Python 3, port fastimport plugin to Python 3.

Merged from https://code.launchpad.net/~jelmer/brz/fastimport-fixes/+merge/348924

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
    """
32
32
    with open(filename, 'wb') as f:
33
33
        for commit_id in revision_ids:
34
 
            f.write("%s %s\n" % (commit_id, revision_ids[commit_id]))
 
34
            f.write(b"%s %s\n" % (commit_id, revision_ids[commit_id]))
35
35
 
36
36
 
37
37
def load_id_map(filename):
51
51
    result = {}
52
52
    count = 0
53
53
    if os.path.exists(filename):
54
 
        f = open(filename)
55
 
        try:
 
54
        with open(filename) as f:
56
55
            for line in f:
57
56
                parts = line[:-1].split(' ', 1)
58
57
                result[parts[0]] = parts[1]
59
58
                count += 1
60
 
        finally:
61
 
            f.close()
62
59
    return result, count