comparison hggit/git_handler.py @ 1127:108d9303ef71

git_handler: use repo.__getitem__ instead of (removed) repo.changectx As stated in https://phab.mercurial-scm.org/D3037, repo.__getitem__ should be used instead of repo.changectx, which was removed.
author Paul Morelle <paul.morelle@octobus.net>
date Thu, 17 May 2018 07:51:47 +0200
parents 8f55daa87ce4
children 6141895a53c9
comparison
equal deleted inserted replaced
1126:e41773ad3584 1127:108d9303ef71
548 def export_hg_commit(self, rev, exporter): 548 def export_hg_commit(self, rev, exporter):
549 self.ui.note(_("converting revision %s\n") % hex(rev)) 549 self.ui.note(_("converting revision %s\n") % hex(rev))
550 550
551 oldenc = self.swap_out_encoding() 551 oldenc = self.swap_out_encoding()
552 552
553 ctx = self.repo.changectx(rev) 553 ctx = self.repo[rev]
554 extra = ctx.extra() 554 extra = ctx.extra()
555 555
556 commit = Commit() 556 commit = Commit()
557 557
558 (time, timezone) = ctx.date() 558 (time, timezone) = ctx.date()
872 # - changes in gitlinks 872 # - changes in gitlinks
873 hgsubstate = util.parse_hgsubstate( 873 hgsubstate = util.parse_hgsubstate(
874 self.git_file_readlines(git_commit_tree, '.hgsubstate')) 874 self.git_file_readlines(git_commit_tree, '.hgsubstate'))
875 parentsubdata = '' 875 parentsubdata = ''
876 if gparents: 876 if gparents:
877 p1ctx = self.repo.changectx(gparents[0]) 877 p1ctx = self.repo[gparents[0]]
878 if '.hgsubstate' in p1ctx: 878 if '.hgsubstate' in p1ctx:
879 parentsubdata = p1ctx.filectx('.hgsubstate').data() 879 parentsubdata = p1ctx.filectx('.hgsubstate').data()
880 parentsubdata = parentsubdata.splitlines() 880 parentsubdata = parentsubdata.splitlines()
881 parentsubstate = util.parse_hgsubstate(parentsubdata) 881 parentsubstate = util.parse_hgsubstate(parentsubdata)
882 for path, sha in parentsubstate.iteritems(): 882 for path, sha in parentsubstate.iteritems():
956 # the list of changed files so that Mercurial can join up their 956 # the list of changed files so that Mercurial can join up their
957 # filelog histories (same as if the merge was done in Mercurial to 957 # filelog histories (same as if the merge was done in Mercurial to
958 # begin with). 958 # begin with).
959 if p2 == nullid: 959 if p2 == nullid:
960 return [] 960 return []
961 manifest1 = self.repo.changectx(p1).manifest() 961 manifest1 = self.repo[p1].manifest()
962 manifest2 = self.repo.changectx(p2).manifest() 962 manifest2 = self.repo[p2].manifest()
963 return [path for path, node1 in manifest1.iteritems() if path not 963 return [path for path, node1 in manifest1.iteritems() if path not
964 in files and manifest2.get(path, node1) != node1] 964 in files and manifest2.get(path, node1) != node1]
965 965
966 def getfilectx(repo, memctx, f): 966 def getfilectx(repo, memctx, f):
967 info = files.get(f) 967 info = files.get(f)