]> thyrsus.com Git - src.git/commitdiff
.srcignore is interpreted.
authorEric S. Raymond <esr@thyrsus.com>
Sun, 9 Nov 2014 11:22:21 +0000 (06:22 -0500)
committerEric S. Raymond <esr@thyrsus.com>
Sun, 9 Nov 2014 11:22:21 +0000 (06:22 -0500)
NEWS
TODO
src
src.asc

diff --git a/NEWS b/NEWS
index 222bd6f6b3d3deeb5c6a5c25bf9f7caef5942ea3..9cec48aea194e02bb0441486674a2fc9a8364e34 100644 (file)
--- 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 1987f03f290b435ea811e75db5df866bf7ca1e71..da1a96fe6eeaee970c98a10c7f4e0b9f0c762682 100644 (file)
--- a/TODO
+++ b/TODO
@@ -3,5 +3,3 @@
 * src branch
 
 * vc.el
-
-* .srcignore
diff --git a/src b/src
index 64c12f4ad47ab5a14db22bf914e19f1b7ef97961..e603ae772926545dfc7816c4a9579078618a3ae0 100755 (executable)
--- 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 f27e6cd43940b46caf8c35f946d60df0fdbd2378..a40c94dbbd0e1776bc1c406f4b1f56260b91e862 100644 (file)
--- 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