~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to baz2bzr

  • Committer: Aaron Bentley
  • Date: 2005-05-13 20:39:05 UTC
  • Revision ID: abentley@troll-20050513203905-57b0e660d3c8f3d2
More log fixups for baz2bzr

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
import shutil
31
31
import bzrlib
32
32
import sys
33
 
import time
 
33
import email.Utils
34
34
from progress import *
35
35
 
36
36
def add_id(files, id=None):
225
225
            os.rename(new, old)
226
226
            branch = bzrlib.Branch(revdir)
227
227
        branch.set_inventory(baz_inv)
228
 
        timestamp = time.mktime(log.date)
 
228
        timestamp = email.Utils.mktime_tz(log.date + (0,))
229
229
            
230
 
        branch.commit(log.summary, verbose=False, timestamp=timestamp, 
231
 
                      committer=log.creator)
 
230
        branch.commit(log.summary, verbose=False,
 
231
                      committer=log.creator, timestamp=timestamp, timezone=0)
232
232
    yield Progress("revisions", len(ancestors), len(ancestors))
233
233
    unlink_unversioned(branch, revdir)
234
234
    os.rename(revdir, output_dir)   
241
241
        else:
242
242
            os.unlink(path)
243
243
 
 
244
def get_log(tree, revision):
 
245
    log = tree.iter_logs(version=revision.version, reverse=True).next()
 
246
    assert log.revision == revision
 
247
    return log
 
248
 
244
249
def get_revision(revdir, revision):
245
250
    revision.get(revdir)
246
251
    tree = pybaz.tree_root(revdir)
247
 
    log = tree.iter_logs(version=revision.version, reverse=True).next()
 
252
    log = get_log(tree, revision)
248
253
    try:
249
254
        return bzr_inventory_data(tree), log 
250
255
    except BadFileKind, e:
254
259
def apply_revision(revdir, revision):
255
260
    tree = pybaz.tree_root(revdir)
256
261
    revision.apply(tree)
257
 
    log = tree.iter_logs(reverse=True).next()
 
262
    log = get_log(tree, revision)
258
263
    try:
259
264
        return bzr_inventory_data(tree), log
260
265
    except BadFileKind, e: