mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 07:17:55 +03:00
strip: simplify some repeated conditions
We check "if saveheads or savebases" in several places to see if we should or have created a bundle of the changesets to apply after truncating the revlogs. One of the conditions is actually just "if saveheads", but since there can't be savebases without saveheads, that is effectively the same condition. It seems simpler to check only once and from then on see if we created the file.
This commit is contained in:
parent
109af2a941
commit
19513cd917
@ -147,7 +147,8 @@ def strip(ui, repo, nodelist, backup=True, topic='backup'):
|
||||
vfs.join(backupfile))
|
||||
repo.ui.log("backupbundle", "saved backup bundle to %s\n",
|
||||
vfs.join(backupfile))
|
||||
if saveheads or savebases:
|
||||
chgrpfile = None
|
||||
if saveheads:
|
||||
# do not compress partial bundle if we remove it from disk later
|
||||
chgrpfile = _bundle(repo, savebases, saveheads, node, 'temp',
|
||||
compress=False)
|
||||
@ -184,7 +185,7 @@ def strip(ui, repo, nodelist, backup=True, topic='backup'):
|
||||
if troffset == 0:
|
||||
repo.store.markremoved(file)
|
||||
|
||||
if saveheads or savebases:
|
||||
if chgrpfile:
|
||||
ui.note(_("adding branch\n"))
|
||||
f = vfs.open(chgrpfile, "rb")
|
||||
gen = exchange.readbundle(ui, f, chgrpfile, vfs)
|
||||
@ -229,12 +230,12 @@ def strip(ui, repo, nodelist, backup=True, topic='backup'):
|
||||
if backupfile:
|
||||
ui.warn(_("strip failed, full bundle stored in '%s'\n")
|
||||
% vfs.join(backupfile))
|
||||
elif saveheads:
|
||||
elif chgrpfile:
|
||||
ui.warn(_("strip failed, partial bundle stored in '%s'\n")
|
||||
% vfs.join(chgrpfile))
|
||||
raise
|
||||
else:
|
||||
if saveheads or savebases:
|
||||
if chgrpfile:
|
||||
# Remove partial backup only if there were no exceptions
|
||||
vfs.unlink(chgrpfile)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user