hgext/absorb.py
changeset 45124 3ee8e2d5c0d8
parent 44991 65d19d9c8e76
child 45125 f55099982bc5
equal deleted inserted replaced
45123:1efbfa9b36a7 45124:3ee8e2d5c0d8
    48     obsolete,
    48     obsolete,
    49     patch,
    49     patch,
    50     phases,
    50     phases,
    51     pycompat,
    51     pycompat,
    52     registrar,
    52     registrar,
       
    53     rewriteutil,
    53     scmutil,
    54     scmutil,
    54     util,
    55     util,
    55 )
    56 )
    56 from mercurial.utils import stringutil
    57 from mercurial.utils import stringutil
    57 
    58 
   780             memworkingcopy = self._getnewfilecontents(ctx)
   781             memworkingcopy = self._getnewfilecontents(ctx)
   781             if not memworkingcopy and not lastcommitted:
   782             if not memworkingcopy and not lastcommitted:
   782                 # nothing changed, nothing commited
   783                 # nothing changed, nothing commited
   783                 nextp1 = ctx
   784                 nextp1 = ctx
   784                 continue
   785                 continue
   785             if ctx.files() and self._willbecomenoop(
   786             if (
   786                 memworkingcopy, ctx, nextp1
   787                 self.skip_empty_successor
       
   788                 and ctx.files()
       
   789                 and self._willbecomenoop(memworkingcopy, ctx, nextp1)
   787             ):
   790             ):
   788                 # changeset is no longer necessary
   791                 # changeset is no longer necessary
   789                 self.replacemap[ctx.node()] = None
   792                 self.replacemap[ctx.node()] = None
   790                 msg = _(b'became empty and was dropped')
   793                 msg = _(b'became empty and was dropped')
   791             else:
   794             else:
   932         }
   935         }
   933         if replacements:
   936         if replacements:
   934             scmutil.cleanupnodes(
   937             scmutil.cleanupnodes(
   935                 self.repo, replacements, operation=b'absorb', fixphase=True
   938                 self.repo, replacements, operation=b'absorb', fixphase=True
   936             )
   939             )
       
   940 
       
   941     @util.propertycache
       
   942     def skip_empty_successor(self):
       
   943         return rewriteutil.skip_empty_successor(self.ui, b'absorb')
   937 
   944 
   938 
   945 
   939 def _parsechunk(hunk):
   946 def _parsechunk(hunk):
   940     """(crecord.uihunk or patch.recordhunk) -> (path, (a1, a2, [bline]))"""
   947     """(crecord.uihunk or patch.recordhunk) -> (path, (a1, a2, [bline]))"""
   941     if type(hunk) not in (crecord.uihunk, patch.recordhunk):
   948     if type(hunk) not in (crecord.uihunk, patch.recordhunk):