From 5a6ee91d4bf1e2728c1647abaf5dbba582a43269 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Sun, 9 Nov 2014 06:22:21 -0500 Subject: [PATCH] .srcignore is interpreted. --- NEWS | 2 +- TODO | 2 -- src | 14 ++++++++++++-- src.asc | 12 +++++++++++- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index 222bd6f..9cec48a 100644 --- a/NEWS +++ b/NEWS @@ -1,7 +1,7 @@ ` src project news Repository head: - There is now a "src status" command. + There is now a "src status" command, and .srcignore affects it. src fast-import is implemented (by callout to rcs-fast-import). 0.2: 2014-11-08 diff --git a/TODO b/TODO index 1987f03..da1a96f 100644 --- a/TODO +++ b/TODO @@ -3,5 +3,3 @@ * src branch * vc.el - -* .srcignore diff --git a/src b/src index 64c12f4..e603ae7 100755 --- a/src +++ b/src @@ -2,7 +2,7 @@ # # src - simple revision control. # -import sys, os, subprocess, time, calendar, stat +import sys, os, subprocess, time, calendar, stat, glob version=0.2 @@ -274,7 +274,8 @@ src checkout ['revision-spec'] ['file'...] co is a synonym for checkout. src status ['file'...] - A = added, U = unmodified, M = modified, ! = missing, ? = not tracked. + A = added, U = unmodified, M = modified, ! = missing, ? = not tracked, + I = ignored. src cat [revision-spec] ['file'...] Send the specified revisions of the files to standard output. @@ -516,7 +517,16 @@ def status_method(*args): else: candidates = [f for f in os.listdir(".") if f != repodir] pairs = [] + ignorable = [] + if os.path.exists(".srcignore"): + for line in open(".srcignore"): + if not line.startswith("#") and line.strip(): + ignorable += glob.glob(line.strip()) for fn in candidates: + if fn in ignorable: + if fn in args: + pairs.append((fn, "I")) + continue masterbase = os.path.basename(backend.master(fn)) if masterbase not in registered: pairs.append((fn, "?")) diff --git a/src.asc b/src.asc index f27e6cd..a40c94d 100644 --- a/src.asc +++ b/src.asc @@ -58,7 +58,8 @@ src checkout [revision-spec] ['file'...]:: co is a synonym for checkout. src status ['file'...]:: - A = added, U = unmodified, M = modified, ! = missing, ? = not tracked. + A = added, U = unmodified, M = modified, ! = missing, ? = not tracked, + I = ignored. src cat [revision-spec] ['file'...]:: Send the specified revisions of the files to standard output. @@ -123,6 +124,15 @@ you will not be in doubt about which operation succeeded. This behavior can be suppressed with the -q option, placed 'before' the subcommand word. +If your directory contains a file named ".srcignore", each line that +is neither blank nor begins with a "#" is interpreted as an ignore +pattern. It is expanded with glob(3), and files in the expansion are +omitted from +src status+ - unless the file is named as an argument, +of the status comand, in which case its status is "I". Thus, for +example, a line reading "*.html" will cause all files with an HTML +extension to be omitted from the output of "git status", but the +output of "git status *" will list them with ststus "I". + == BACKWARD COMPATIBILITY == SRC history files are RCS master files. SRC maintains no state other -- 2.43.0