Refresh the working copy of the file(s) from their history files.
co is a synonym for checkout.
+src status ['file'...]
+ A = added, U = unmodified, M = modified, ! = missing, ? = not tracked.
+
src cat [revision-spec] ['file'...]
Send the specified revisions of the files to standard output.
revision = master[len(master) - revspec[0]].revision
with backend.lifter(arg):
backend.checkout(arg, revision)
+ # Changes the access and modification times
+ # Later, src status will see this. Alas,
+ # there's a tiny race window here.
+ os.utime(backend.master(arg, None))
if not quiet and len(args) > 1:
announce("%s <- %d" % (arg, revspec[0]))
+def status_method(*args):
+ "Get status of some or all fles."
+ try:
+ registered = os.listdir(repodir)
+ except OSError:
+ croak("repo directory %s does not exist" % repodir)
+ if args:
+ candidates = args
+ else:
+ candidates = [f for f in os.listdir(".") if f != repodir]
+ pairs = []
+ for fn in candidates:
+ masterbase = os.path.basename(backend.master(fn))
+ if masterbase not in registered:
+ pairs.append((fn, "?"))
+ continue
+ elif not os.path.exists(fn):
+ pairs.append((fn, "!"))
+ continue
+ # Relies on the fact that we touch the file with utimes(2)
+ # each time it's checked out.
+ elif os.path.getmtime(fn) > os.path.getmtime(backend.master(fn)):
+ pairs.append((fn, "M"))
+ continue
+ metadata = History(fn)
+ if len(metadata) == 0:
+ pairs.append((fn, "A"))
+ else:
+ pairs.append((fn, "U"))
+ if not args:
+ for m in registered:
+ if backend.workfile(m) not in candidates:
+ pairs.append((backend.workfile(m), "!"))
+ pairs.sort()
+ for (fn, status) in pairs:
+ sys.stdout.write(status + "\t" + fn + "\n")
+
def cat_method(*args):
"Dump revision content to standard output."
(revspec, args) = preamble("cat", args)
"log": log_method,
"checkout": checkout_method,
"co": checkout_method,
+ "status": status_method,
"cat": cat_method,
"diff": diff_method,
"tag": tag_method,