2 from yap
.yap
import YapCore
, YapError
3 from yap
.util
import run_command
6 class BackupPlugin(YapCore
):
7 "Save a backup of files before reverting them"
9 def cmd_revert(self
, *args
, **flags
):
11 changed
= set(self
._get
_staged
_files
() + self
._get
_unstaged
_files
())
16 files
= files
.intersection(changed
)
18 files
= [ x
for x
in files
if os
.access(x
, os
.R_OK
) ]
21 run_command("cp %s %s~" % (f
, f
))
22 super(BackupPlugin
, self
).cmd_revert(*args
, **flags
)