def main(args, repo): if repo is None: repo = manager.resolve() with repo.lock: if len(args) == 0: import help as p_help p_help.main(["ignore"]) return 1 elif args[0] == "list": print "\n".join(repo.get_ignores()) elif args[0] == "remove": ignores = repo.get_ignores() for pattern in args[1:]: if not pattern in ignores: print 'Can\'t remove "%s" from ignores, not present' % pattern else: ignores.remove(pattern) repo.set_ignores(ignores) else: ignores = repo.get_ignores() ignores += args repo.set_ignores(ignores) return 0
def main(args, repo): if repo is None: repo = manager.resolve() with repo.lock: csnap = repo.get_current_snapshot() for name, ctime in repo.list_snapshots(): indic = '*' if csnap == name else ' ' print '%20s %s %s' % (name, indic, ctime) return 1
def main(args, repo): if repo is not None: import help as p_help p_help.main(['init']) return 1 try: manager.resolve() print 'No nested projects!' return 1 except Exception: pass if not any(not x.startswith('.') for x in os.listdir('.')): raise Exception('Not initializing empty directory!') ppath = os.environ['PWD'] phash = manager.shash(ppath) if len(args) < 1: args.append(raw_input("Give a name for this project: ")) #if len(args) < 2: # args.append(raw_input("Give the name of the executable for this project: ")) # TODO: validate names #try: # open(args[1]) #except: # print "Executable file doesn't exist!" # print 'it was "%s"' % args[1] # return 1 cfgdir = os.path.join(manager.PATH, phash) os.mkdir(cfgdir) os.symlink(cfgdir, os.path.join(manager.PATH, args[0])) os.mkdir(os.path.join(cfgdir, 'snapshots')) os.mkdir(os.path.join(cfgdir, 'config')) open(os.path.join(cfgdir, 'config/destination'), 'w').write(ppath) repo = manager.Project(cfgdir) with repo.lock: #repo.set_executable(args[1]) repo.set_ignores([]) repo.snapshot('original') return 0
def main(): if len(sys.argv) < 2: return cmd('help') elif sys.argv[1] in commands: return cmd(sys.argv[1], sys.argv[2:]) elif len(sys.argv) < 3: return cmd('help') elif sys.argv[2] in commands: repo = manager.resolve(sys.argv[1]) return cmd(sys.argv[2], sys.argv[3:], repo) else: return cmd('help')
def main(args, repo): if repo is None: repo = manager.resolve() with repo.lock: if len(args) == 0: import help as p_help p_help.main(['use']) return 1 if args[0] not in zip(*repo.list_snapshots())[0]: print 'Argument is not a snapshot name!' return 1 repo.restore(args[0]) return 0
def main(args, repo): if repo is None: repo = manager.resolve() with repo.lock: if len(args) == 0: import help as p_help p_help.main(['snap']) return 1 if args[0] in zip(*repo.list_snapshots())[0]: print 'There is already a snapshot named "%s"!' % args[0] return 1 repo.snapshot(args[0]) return 0
def main(args, repo): if repo is None: repo = manager.resolve() with repo.lock: if len(args) == 0: snap = repo.get_current_snapshot() else: snap = args[0] if not snap in zip(*repo.list_snapshots())[0]: print '%s is not a snapshot name!' % snap return 1 diffs = repo.compare_snapshot(snap) if len(diffs) == 0 or (len(diffs) == 1 and diffs[0] == ''): print 'Using snapshot %s' % snap return 0 else: print 'Using snapshot %s, with modifications:' % snap print '\n'.join(diffs) return 1
def main(args=[], repo=None): if repo is None: repo = manager.resolve() with repo.lock: repo.delete() return 0