mercurial/repair.py
changeset 32942 f044295cdb7a
parent 32941 e413609659cf
child 32943 4c6e4a4486a0
equal deleted inserted replaced
32941:e413609659cf 32942:f044295cdb7a
    77 
    77 
    78 def strip(ui, repo, nodelist, backup=True, topic='backup'):
    78 def strip(ui, repo, nodelist, backup=True, topic='backup'):
    79     # This function requires the caller to lock the repo, but it operates
    79     # This function requires the caller to lock the repo, but it operates
    80     # within a transaction of its own, and thus requires there to be no current
    80     # within a transaction of its own, and thus requires there to be no current
    81     # transaction when it is called.
    81     # transaction when it is called.
       
    82     if repo.currenttransaction() is not None:
       
    83         raise error.ProgrammingError('cannot strip from inside a transaction')
       
    84 
    82     # Simple way to maintain backwards compatibility for this
    85     # Simple way to maintain backwards compatibility for this
    83     # argument.
    86     # argument.
    84     if backup in ['none', 'strip']:
    87     if backup in ['none', 'strip']:
    85         backup = False
    88         backup = False
    86 
    89 
   166         tmpbundlefile = _bundle(repo, savebases, saveheads, node, 'temp',
   169         tmpbundlefile = _bundle(repo, savebases, saveheads, node, 'temp',
   167                                 compress=False, obsolescence=False)
   170                                 compress=False, obsolescence=False)
   168 
   171 
   169     mfst = repo.manifestlog._revlog
   172     mfst = repo.manifestlog._revlog
   170 
   173 
   171     if repo.currenttransaction() is not None:
       
   172         raise error.ProgrammingError('cannot strip from inside a transaction')
       
   173 
       
   174     try:
   174     try:
   175         with repo.transaction("strip") as tr:
   175         with repo.transaction("strip") as tr:
   176             offset = len(tr.entries)
   176             offset = len(tr.entries)
   177 
   177 
   178             tr.startgroup()
   178             tr.startgroup()