mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 07:17:55 +03:00
backups: make hg backups evolve aware
Summary: backups: make hg backups evolve aware With this patch: hg backups urges evolve user to look at hg reflog to recover hidden commits. This is because evolve's commands are using obsolescence markers to hide commits instead of stripping them. Test Plan: Cross repo dependency, not sure how to make an automated test Reviewers: durham, pyd Differential Revision: https://phabricator.fb.com/D2088486 Tasks: 6534705
This commit is contained in:
parent
7e1147b62d
commit
25d0314a5b
12
backups.py
12
backups.py
@ -19,6 +19,11 @@ pager.attended.append('backups')
|
||||
cmdtable = {}
|
||||
command = cmdutil.command(cmdtable)
|
||||
testedwith = 'internal'
|
||||
msgwithevolve = """Evolve is enabled so no commit should be stripped unless you
|
||||
explicitely called hg strip. hg backups will show you the stripped commits.
|
||||
If you are trying to recover a commit hidden from a previous command, use hg
|
||||
reflog to get its sha1 and you will be able to access it directly without
|
||||
recovering a backup."""
|
||||
|
||||
@command('^backups', [
|
||||
('', 'recover', '', 'brings the specified commit back into the repository')
|
||||
@ -35,6 +40,13 @@ def backups(ui, repo, *pats, **opts):
|
||||
--verbose will print the entire commit message and the bundle path for that
|
||||
backup.
|
||||
'''
|
||||
try:
|
||||
if extensions.find('evolve'):
|
||||
# Warn evolve users that they probably don't want to use backups
|
||||
# but reflog instead
|
||||
ui.warn(msgwithevolve)
|
||||
except KeyError:
|
||||
pass
|
||||
backuppath = repo.join("strip-backup")
|
||||
backups = filter(os.path.isfile, glob.glob(backuppath + "/*.hg"))
|
||||
backups.sort(key=lambda x: os.path.getmtime(x), reverse=True)
|
||||
|
Loading…
Reference in New Issue
Block a user