hgext/convert/hg.py
changeset 42620 d98ec36be808
parent 41771 1312afae2d51
child 42979 b4093d1d3b18
equal deleted inserted replaced
42619:20d0e59be79b 42620:d98ec36be808
   337             # commit, so copy the source's phase for now.
   337             # commit, so copy the source's phase for now.
   338             self.repo.ui.setconfig('phases', 'new-commit',
   338             self.repo.ui.setconfig('phases', 'new-commit',
   339                                    phases.phasenames[commit.phase], 'convert')
   339                                    phases.phasenames[commit.phase], 'convert')
   340 
   340 
   341             with self.repo.transaction("convert") as tr:
   341             with self.repo.transaction("convert") as tr:
   342                 node = nodemod.hex(self.repo.commitctx(ctx))
   342                 if self.repo.ui.config('convert', 'hg.preserve-hash'):
       
   343                     origctx = commit.ctx
       
   344                 else:
       
   345                     origctx = None
       
   346                 node = nodemod.hex(self.repo.commitctx(ctx, origctx=origctx))
   343 
   347 
   344                 # If the node value has changed, but the phase is lower than
   348                 # If the node value has changed, but the phase is lower than
   345                 # draft, set it back to draft since it hasn't been exposed
   349                 # draft, set it back to draft since it hasn't been exposed
   346                 # anywhere.
   350                 # anywhere.
   347                 if commit.rev != node:
   351                 if commit.rev != node:
   589                              optparents=optparents,
   593                              optparents=optparents,
   590                              branch=ctx.branch(),
   594                              branch=ctx.branch(),
   591                              extra=ctx.extra(),
   595                              extra=ctx.extra(),
   592                              sortkey=ctx.rev(),
   596                              sortkey=ctx.rev(),
   593                              saverev=self.saverev,
   597                              saverev=self.saverev,
   594                              phase=ctx.phase())
   598                              phase=ctx.phase(),
       
   599                              ctx=ctx)
   595 
   600 
   596     def numcommits(self):
   601     def numcommits(self):
   597         return len(self.repo)
   602         return len(self.repo)
   598 
   603 
   599     def gettags(self):
   604     def gettags(self):