comparison hgfastimport/hgimport.py @ 60:efc96910ddf2

Make --sourcesort work by assigning a sortkey to every commit. The sortkey is just the integer form of the 'mark' (cmd.id), which is probably not 100% correct, but good enough most of the time. (I'm assuming that most fast-exporters will export a monotonically increasing stream of commit IDs.)
author Greg Ward <gward@intelerad.com>
date Mon, 01 Aug 2011 22:09:19 -0400
parents c82b6a84884f
children
comparison
equal deleted inserted replaced
59:c82b6a84884f 60:efc96910ddf2
314 assert type(cmd.message) is unicode 314 assert type(cmd.message) is unicode
315 text = cmd.message.encode("utf-8") 315 text = cmd.message.encode("utf-8")
316 date = self.convert_date(userinfo) 316 date = self.convert_date(userinfo)
317 317
318 parents = filter(None, [first_parent, second_parent]) 318 parents = filter(None, [first_parent, second_parent])
319 commit = common.commit(user, date, text, parents, branch, rev=cmd.id) 319 commit = common.commit(user, date, text, parents, branch,
320 rev=cmd.id, sortkey=int(cmd.id[1:]))
320 321
321 self.commitmap[cmd.id] = commit 322 self.commitmap[cmd.id] = commit
322 heads = self.branchmap.get(branch) 323 heads = self.branchmap.get(branch)
323 if heads is None: 324 if heads is None:
324 heads = [cmd.id] 325 heads = [cmd.id]