mercurial/repair.py
changeset 37016 17692fefc8f2
parent 36702 f659a407e5ee
child 37084 f0b6fbea00cf
equal deleted inserted replaced
37015:a318bb154d42 37016:17692fefc8f2
    25     obsolete,
    25     obsolete,
    26     obsutil,
    26     obsutil,
    27     util,
    27     util,
    28 )
    28 )
    29 
    29 
    30 def _bundle(repo, bases, heads, node, suffix, compress=True, obsolescence=True):
    30 def backupbundle(repo, bases, heads, node, suffix, compress=True,
       
    31                  obsolescence=True):
    31     """create a bundle with the specified revisions as a backup"""
    32     """create a bundle with the specified revisions as a backup"""
    32 
    33 
    33     backupdir = "strip-backup"
    34     backupdir = "strip-backup"
    34     vfs = repo.vfs
    35     vfs = repo.vfs
    35     if not vfs.isdir(backupdir):
    36     if not vfs.isdir(backupdir):
   164     # create a changegroup for all the branches we need to keep
   165     # create a changegroup for all the branches we need to keep
   165     backupfile = None
   166     backupfile = None
   166     vfs = repo.vfs
   167     vfs = repo.vfs
   167     node = nodelist[-1]
   168     node = nodelist[-1]
   168     if backup:
   169     if backup:
   169         backupfile = _bundle(repo, stripbases, cl.heads(), node, topic)
   170         backupfile = backupbundle(repo, stripbases, cl.heads(), node, topic)
   170         repo.ui.status(_("saved backup bundle to %s\n") %
   171         repo.ui.status(_("saved backup bundle to %s\n") %
   171                        vfs.join(backupfile))
   172                        vfs.join(backupfile))
   172         repo.ui.log("backupbundle", "saved backup bundle to %s\n",
   173         repo.ui.log("backupbundle", "saved backup bundle to %s\n",
   173                     vfs.join(backupfile))
   174                     vfs.join(backupfile))
   174     tmpbundlefile = None
   175     tmpbundlefile = None
   177         #
   178         #
   178         # We do not include obsolescence, it might re-introduce prune markers
   179         # We do not include obsolescence, it might re-introduce prune markers
   179         # we are trying to strip.  This is harmless since the stripped markers
   180         # we are trying to strip.  This is harmless since the stripped markers
   180         # are already backed up and we did not touched the markers for the
   181         # are already backed up and we did not touched the markers for the
   181         # saved changesets.
   182         # saved changesets.
   182         tmpbundlefile = _bundle(repo, savebases, saveheads, node, 'temp',
   183         tmpbundlefile = backupbundle(repo, savebases, saveheads, node, 'temp',
   183                                 compress=False, obsolescence=False)
   184                                      compress=False, obsolescence=False)
   184 
   185 
   185     try:
   186     try:
   186         with repo.transaction("strip") as tr:
   187         with repo.transaction("strip") as tr:
   187             offset = len(tr.entries)
   188             offset = len(tr.entries)
   188 
   189