Package moap :: Package command :: Module vcs
[hide private]
[frames] | no frames]

Source Code for Module moap.command.vcs

 1  # -*- Mode: Python -*- 
 2  # vi:si:et:sw=4:sts=4:ts=4 
 3   
 4  import os 
 5  import sys 
 6   
 7  from moap.vcs import vcs 
 8  from moap.util import util, mail 
 9   
10 -class Backup(util.LogCommand):
11 summary = "back up working copy" 12 description = """Backs up the working copy to the given archive. 13 14 The archive can be used with the restore command to restore the working copy 15 to its original state, modulo all ignored files. 16 17 The archive includes checkout commands, a local diff, and all untracked files. 18 """ 19
20 - def do(self, args):
21 if not args: 22 sys.stderr.write('Please specify a path for the archive.\n') 23 return 3 24 25 archive = args[0] 26 27 path = os.getcwd() 28 if len(args) > 1: 29 path = args[1] 30 31 v = vcs.detect(path) 32 if not v: 33 sys.stderr.write('No VCS detected in %s\n' % path) 34 return 3 35 36 v.backup(archive) 37 self.stdout.write("Archived working copy '%s' to '%s'.\n" % ( 38 path, archive))
39
40 -class VCS(util.LogCommand):
41 description = "do version control system-specific things" 42 subCommandClasses = [Backup]
43