File: inventory.html

package info (click to toggle)
arch 1.0pre15-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 20,180 kB
  • ctags: 4,560
  • sloc: ansic: 64,410; sh: 29,168; lisp: 1,896; awk: 1,044; makefile: 484; sed: 26
file content (1500 lines) | stat: -rw-r--r-- 38,098 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
<html>
<head>
<title>arch Project Inventories</title>
</head>
<body>

<a name="arch_Project_Inventories"></a>

<a href="http://www.regexps.com">The Hackerlab at <code>regexps.com</code></a>

<h2 align=center>arch Project Inventories</h2>




<small>
<b>up: </b><a href="arch.html#arch">arch</a></br>
<b>next: </b><a href="patches.html#arch_Patch_Sets">arch Patch Sets</a></br>

<b>prev: </b><a href="project-trees.html#arch_Project_Trees">arch Project Trees</a></br>

</small>
<br>






<p>In a project tree, some of the files and directories are &quot;part of
the source&quot; -- they are of interest to <code>arch</code>
.  Other files and
directories may be scratch files, editor back-up files, and temporary
or intermediate files generated by programs.  Those other files should
be ignored by most <code>arch</code>
 commands.
</p><p>This chapter discusses how <code>arch</code>
 recognizes which files to pay
attention to, and which to ignore.
</p><p><code>arch</code>
 has flexible facilities for keeping track of all of the files
and directories in your project: for taking &quot;inventories&quot; of your
project tree.  It has these facilities for three reasons:
</p><p><strong><u>Distinguishing Source</u></strong> <code>arch</code>
 uses a project inventory to
distingiuish files and directories which are part of your project from
other files and directories which are temporary files, scratch files,
editor backup-files, and so forth.
</p><p>Additionally, <code>arch</code>
 permits you to overlay projects: store more than
one project at a single root.  When you do that, <code>arch</code>
 uses
inventories to sort out which files and directories belong to each
project.  (The topic of overlays, however, is deferred until a later
chapter.)
</p><p><strong><u>Recognizing Renames</u></strong> Every file or directory in an <code>arch</code>
 inventory
has two names.  One name is simply the location (path) of the file
relative to the root of the project tree.  The other name is a
&quot;logical name&quot; for the file: a name that remains the same regardless
of where in the project tree the file is located.  When <code>arch</code>

compares two versions of a project tree, it uses logical names to
discover when files or directories have been moved, renamed, deleted,
or added.
</p><p><strong><u>Canonical Inventories</u></strong> Finally, <code>arch</code>
 permits you to make a record
of the &quot;canonical inventory&quot; of your project -- all of the files
that you believe are <strong>supposed</strong> to be there.  <code>arch</code>
 can then tell you
whether any files are missing or have been added compared to the
canonical inventory.
</p><ul>
<li><a href="inventory.html#Choices_Regarding_Inventories">Choices Regarding Inventories</a></li>
<li><a href="inventory.html#Specifying_a_Tagging_Method">Specifying a Tagging Method</a></li>
<li><a href="inventory.html#The_inventory_Command">The inventory Command</a></li>
<li><a href="inventory.html#Using_an_Explicit_Inventory">Using an Explicit Inventory</a></li>
<li><a href="inventory.html#Using_an_Implicit_Inventory">Using an Implicit Inventory</a></li>
<li><a href="inventory.html#Recognizing_Renames_--_Inventory_Tags">Recognizing Renames -- Inventory Tags</a></li>
<li><a href="inventory.html#Keeping_Things_Neat_and_Tidy">Keeping Things Neat and Tidy</a></li>
<li><a href="inventory.html#Avoiding_Accidental_Ommissions_and_Additions">Avoiding Accidental Ommissions and Additions</a></li>
<li><a href="inventory.html#The_Inventory_Tag_Abstraction_in_Detail">The Inventory Tag Abstraction in Detail</a></li>
<li><a href="inventory.html#A_Warning_About_Changing_Tagging_Methods">A Warning About Changing Tagging Methods</a></li>
<li><a href="inventory.html#Other_Ways_to_Tag_Files">Other Ways to Tag Files</a></li>
<li><a href="inventory.html#Telling_tree-lint_to_Shut_Up">Telling tree-lint to Shut Up</a></li>
<li><a href="inventory.html#Which_Tagging_Method_Should_You_Use?">Which Tagging Method Should You Use?</a></li>
<li><a href="inventory.html#Altering_the_Naming_Conventions">Altering the Naming Conventions</a></li>
</ul>

<hr>

<a name="Choices_Regarding_Inventories"></a>



<h3 align=center>Choices Regarding Inventories</h3>




<small>
<b>up: </b><a href="inventory.html#arch_Project_Inventories">arch Project Inventories</a></br>
<b>next: </b><a href="inventory.html#Specifying_a_Tagging_Method">Specifying a Tagging Method</a></br>


</small>
<br>






<p>For each project tree, you have a choice to make regarding how project
inventories work.  The options are described briefly here, then in
more detail in the sections that follow.
</p><p><strong><u>Naming Conventions</u></strong> The simplest (and default) option is to simply
use <em>
<a name="index-pt:0"></a>

naming conventions
</em>
.  <code>arch</code>
 will search your tree for files
matching certain naming patterns, and consider all of those files to
be source files.
</p><p>When you use only naming conventions to take an inventory, the logical
name of a file and its location name are exactly the same.  For that
reason, if you rename a file, <code>arch</code>
 will think you deleted a file
with the old name, and added a file with the new name.  If you delete
a file, then add a file with the same name, <code>arch</code>
 will think that the
new file is a modified form of the old file.  None of those
limitations are fatal, <code>arch</code>
 will still work, but they do limit the
effectiveness of <code>arch</code>
 at branching and merging.  (&quot;Branching&quot; and
&quot;merging&quot; are topics of a later chapter.)
</p><p><strong><u>Explicit Inventories</u></strong> Another option is to use an <em>
<a name="index-pt:1"></a>

explicit inventory
</em>
.
Once again, <code>arch</code>
 will search for files that satisfy certain naming
conventions -- but not every such file or directory is automatically
source.  Instead, whenever you add, delete or renamed a file, you must
inform <code>arch</code>
 of that fact explicitly.  For example, after adding the
file <code>foo.c</code>
, you have to tell <code>arch</code>
:
</p><pre>
        % larch add foo.c

</pre>
<p>and if you rename <code>foo.c</code>
 to <code>bar.c</code>
, then you must also tell <code>arch</code>
:
</p><pre>
        % larch move foo.c bar.c

</pre>
<p><strong><u>Implicit Inventories</u></strong> A third option combines some of the advantages
of using naming conventions with some of the advantages of explicit
inventories: <em>
<a name="index-pt:2"></a>

implicit inventories
</em>
.  When you use an implicit
inventory, every file that passes the naming conventions is considered
source.  You <strong>may</strong> explicitly add, delete, and rename files --
allowing <code>arch</code>
 to precisely track renames for those files and
directories.  You also <strong>may</strong> store a <em>
<a name="index-pt:3"></a>

file tag
</em>
 (the &quot;logical name&quot;
of a file) <em>in</em> any file.  If you don't explicitly tag a file, and use
an implicit inventory, <code>arch</code>
 will search for those embedded tags and
use them to precisely detect new files, deleted files, and renamed
files.
</p><p>Each of the three options is called a <em>
<a name="index-pt:4"></a>

tagging method
</em>
.
</p><p>There is some advice at the end of this chapter about how to choose
among the three tagging methods.
</p>










<hr>

<a name="Specifying_a_Tagging_Method"></a>



<h3 align=center>Specifying a Tagging Method</h3>




<small>
<b>up: </b><a href="inventory.html#arch_Project_Inventories">arch Project Inventories</a></br>
<b>next: </b><a href="inventory.html#The_inventory_Command">The inventory Command</a></br>

<b>prev: </b><a href="inventory.html#Choices_Regarding_Inventories">Choices Regarding Inventories</a></br>

</small>
<br>






<p><a name="index-pt:5"></a>

</p><p>If you never explicitly specify a tagging method, <code>arch</code>
 will use
simple naming conventions, by default.  You can also make explicit
your choice to use only naming conventions with this command issued in
a project tree:
</p><pre>
        % larch tagging-method names

</pre>
<p>Similarly, to use either an implicit or explicit inventory, use one of
the commands:
</p><pre>
        % larch tagging-method explicit
        % larch tagging-method implicit

</pre>
<p>To find out what method a given project tree uses, use the same
command with no argument:
</p><pre>
        % larch tagging-method
        names

</pre>











<hr>

<a name="The_inventory_Command"></a>



<h3 align=center>The inventory Command</h3>




<small>
<b>up: </b><a href="inventory.html#arch_Project_Inventories">arch Project Inventories</a></br>
<b>next: </b><a href="inventory.html#Using_an_Explicit_Inventory">Using an Explicit Inventory</a></br>

<b>prev: </b><a href="inventory.html#Specifying_a_Tagging_Method">Specifying a Tagging Method</a></br>

</small>
<br>






<p><a name="index-pt:6"></a>

</p><p>The command <code>larch inventory</code>
 is used to print a list of source files.
It has many options, including options to print other kinds of file
lists (such as a list of all editor backup files, or a list of all
files which are not source):
</p><pre>
        % cd source-tree

</pre>
<pre>
        % larch inventory --source
        hello.c
        hello.h
        library
        library/buffer.c
        library/buffer.h
        ...

</pre>
<p>contrasted with:
</p><pre>
        % cd source-tree

</pre>
<pre>
        % ls
        hello.c   hello.c.~1~   hello.h  library

</pre>
<p>(Notice that <code>hello.c.~1~</code>
 is not included in the inventory of
source files.)
</p><p>The naming conventions used by <code>arch</code>
 are as follows:
</p><p><strong><u>Control Files</u></strong> A <em>
<a name="index-pt:7"></a>

control file
</em>
 <em>is</em> part of the source, but control
files are not included in the output of <code>larch inventory</code>
 unless the
<code>--all</code>
 flag is used.  Control file and directory names match any of
these patterns:
</p><pre>
        .arch-project-tree
        .arch-ids
        .owned.*
        .common
        {arch}

</pre>
<p><strong><u>Junk Files</u></strong> A <em>
<a name="index-pt:8"></a>

junk file
</em>
 is <em>not</em> part of the source.  A junk file
or directory name matches the pattern:
</p><pre>
        ,*

</pre>
<p>or if it contains any of the characters:
</p><pre>
        &lt;space>
        &lt;tab>
        &lt;newline>
        [
        ]

</pre>
<pre>
        ?
        \

</pre>
<p>Note that if a directory name matches that pattern, then none of the
contents of the directory are part of the source, regardless of their
names.
</p><p>Junk files are listed by the command:
</p><pre>
        % larch inventory --junk

</pre>
<p>Arch sometimes creates junk files and directories of its own.  When it
does, those files and directories have names that match the pattern:
</p><pre>
        ,,*

</pre>
<p>You should avoid creating files and directories with names that match
that pattern.  <code>arch</code>
 will freely delete files and directories with
names that match <code>,,*</code>
 whenever it needs to re-use such a name.
</p><p>Usually, <code>arch</code>
 will delete any junk file it creates before the
command that created the junk file terminates.  Sometimes, though,
when a command fails, <code>arch</code>
 will leave behind junk files or
directories matching <code>,,*</code>
.  This is a debugging feature, likely to be
removed in a future release.  For now, whenever you find such a file
(and are confident it isn't being used by a currently running
command), you are free to delete it.
</p><p><strong><u>Backup Files</u></strong> If a file is not a junk file, it may be a <em>
<a name="index-pt:9"></a>

backup
file
</em>
.  Backup files are not part of the source.  They match any of
the patterns:
</p><pre>
      *~
      *.bak
      *.modified
      *.orig
      *.original
      *.rej
      *.rejects

</pre>
<p>Backup files are listed by the command:
</p><pre>
        % larch inventory --backups

</pre>
<p><strong><u>Precious Files</u></strong> If a file is not a control file, junk file, or backup
file, it might be a <em>
<a name="index-pt:10"></a>

precious file
</em>
.  Precious files are not part of
the source, but <code>arch</code>
 does sometimes treat them specially.  For
example, when <code>arch</code>
 copies a directory of source for you, it copies
not only the source files, but the precious files as well.
</p><p>Precious files and directories match one of these patterns:
</p><pre>
        +*
        .gdbinit
        =build*
        =install*
        CVS
        RCS
        TAGS

</pre>
<p>Of course, precious files can be listed by the command:
</p><pre>
        % larch inventory --precious

</pre>
<p>Sometimes <code>arch</code>
 will create its own precious files -- usually to save
some information that you might not want to lose.  When it does, it
creates a file or directory matching the pattern:
</p><pre>
        ++*

</pre>
<p>You should avoid creating such filenames yourself.  <code>arch</code>
 won't every
delete such a file -- but if one happens to get in the way of an
<code>arch</code>
 command, that command will fail with an error.
</p><p><strong><u>Source Files</u></strong> If a file is not a control, junk, backup, or precious
file, it might be an ordinary <em>
<a name="index-pt:11"></a>

source file
</em>
.  Source files are, of
course, the files that <code>arch</code>
 stores in an archive (along with control
files).
</p><p>Source files must match the pattern:
</p><pre>
        [=a-zA-Z0-9]*

</pre>
<p>but must <em>not</em> match any of the patterns:
</p><pre>
      *.o
      *.core
      core

</pre>
<p>Ordinary source files are listed by:
</p><pre>
        % larch inventory --source

</pre>
<p>Some files which are <code>arch</code>
 control files are counted as source even
though they don't match the patterns above.  However, these files are
not listed by default.  All source files (ordinary source plus control
files) are listed by:
</p><pre>
        % larch inventory --source --all

</pre>
<p><strong><u>Unrecognized Files</u></strong>  Any file that doesn't fall into the above
categories is an <em>
<a name="index-pt:12"></a>

unrecognized file
</em>
.  Unrecognized files can be
listed by the command:
</p><pre>
       % larch inventory --unrecognized

</pre>
<p><strong><u>WARNING</u></strong> The basic pattern for source files is:
</p><pre>
        [=a-zA-Z]*

</pre>
<p>however, you should restrict yourself to file names that do not
contain spaces.  Filenames containing spaces are likely to trigger
bugs in the current release of <code>arch</code>
.
</p>










<hr>

<a name="Using_an_Explicit_Inventory"></a>



<h3 align=center>Using an Explicit Inventory</h3>




<small>
<b>up: </b><a href="inventory.html#arch_Project_Inventories">arch Project Inventories</a></br>
<b>next: </b><a href="inventory.html#Using_an_Implicit_Inventory">Using an Implicit Inventory</a></br>

<b>prev: </b><a href="inventory.html#The_inventory_Command">The inventory Command</a></br>

</small>
<br>






<p><a name="index-pt:13"></a>

<a name="index-pt:14"></a>

<a name="index-pt:15"></a>

<a name="index-pt:16"></a>

</p><p>If you want to use explicit designation of source filess, rather than
naming conventions alone, then use this command:
</p><pre>
        % larch tagging-method explicit

</pre>
<p>Note that you must use that command from within a working directory
tree that has already been initialized using <code>init</code>
.
</p><p>When using explicit designation, it is (ordinarilly) necessary to add
every file and directory in the source to the explicit list using the
command:
</p><pre>
        % larch add FILE

</pre>
<p>If <code>FILE</code>
 is a directory, that will create <code>FILE/.arch_ids/=id</code>
.  If
it is a regular file or symbolic link, it will create (in the same
directory) <code>.arch_ids/FILE.id</code>
.  In either case, the file created will
contain an obscure string known as an &quot;inventory tag&quot; (inventory
tags are explained in more detail below).
</p><p>If you remove a regular file or symbolic link, you must use the
command:
</p><pre>
        % larch delete FILE

</pre>
<p>That won't remove <code>FILE</code>
 itself, but it will remove the inventory tag
for <code>FILE</code>
.
</p><p>In order to remove a directory, you must yourself remove the
<code>.arch_ids</code>
 subdirectory.  That will also implicitly remove the
inventory tags of any files that <code>arch</code>
 thinks are stored in that
directory.
</p><p>If you rename a regular file or symbolic link, you can use the
command:
</p><pre>
        % larch move OLD-NAME NEW-NAME

</pre>
<p>to move the inventory tag for that file.
</p><p>If you rename a directory, it's inventory tag (and the tags for all
files and subdirectories it contains) move with it automatically
(because the <code>.arch_ids</code>
 subdirectory has moved).
</p><p>When you run <code>larch inventory</code>
 in a working directory using explicit
designation, only explicitly designated source files are listed. 
If you would rather see a list of all files passing the naming
conventions for source files, use:
</p><pre>
        % larch inventory --source --names

</pre>
<p>You should also read about <code>tree-lint</code>
 later in this chapter.
</p>










<hr>

<a name="Using_an_Implicit_Inventory"></a>



<h3 align=center>Using an Implicit Inventory</h3>




<small>
<b>up: </b><a href="inventory.html#arch_Project_Inventories">arch Project Inventories</a></br>
<b>next: </b><a href="inventory.html#Recognizing_Renames_--_Inventory_Tags">Recognizing Renames -- Inventory Tags</a></br>

<b>prev: </b><a href="inventory.html#Using_an_Explicit_Inventory">Using an Explicit Inventory</a></br>

</small>
<br>






<p><a name="index-pt:17"></a>

</p><p>To use implicit tagging, use the following command in your working
directory:
</p><pre>
        % larch tagging-method implicit

</pre>
<p>When implicit tagging is used, every file that passes the naming
conventions is treated as source.  If a file or directory has an
explicit tag (created with <code>add</code>
), <code>arch</code>
 will use that explicit
tag to recognize when a file has moved.  If a file (but not a
directory or symbolic link) lacks an explicit tag, <code>arch</code>
 will look
for a tag in the file itself.
</p><p>A tag within a file has one of two forms.  It may be either:
</p><pre>
        &lt;punct>&lt;basename>&lt;spaces>-&lt;spaces>&lt;tag>

</pre>
<p>where <code>&lt;punct></code>
 is an arbitrary string of punctuation and spaces,
<code>&lt;basename></code>
 is the basename of the file, and <code>&lt;tag></code>
 an inventory tag
for the file.  Or:
</p><pre>
        &lt;punct>tag:&lt;spaces>&lt;tag>

</pre>
<p>In either case, <code>&lt;tag></code>
 should be unique among the files within a
directory.  A tag within a file must occur within the first <code>1024</code>
 bytes
of the file.
</p><p>A handy convention for source files is to add a comment to the top of
every file, briefly stating the purpose of the file:
</p><pre>
        /* hello.c - `main' for the hello world program
...

</pre>
<p>or:
</p><pre>
        /* tag: `main' for the hello world program
...

</pre>
<p>Another possible convention is to use a string identifying the author
and the time the file was first created (or first tagged):
</p><pre>
        /* tag: joe.hacker@gnu.org Thu Nov 29 17:25:15 PST 2001
...

</pre>
<p>If you use the <code>basename</code>
 form of an implicit tag, and actually rename
a file (rather than simply move it between directories), you do need
to remember to update the tag line to reflect the new basename.
</p><p>When you use implicit tagging, it is ok if a file lacks any tag at
all, either explicit or implicit.  In that case, if you rename the
file, <code>arch</code>
 will think you've deleted the old file and added a new
one -- but aside from that, everything will work normally.
</p><p><strong><u>CAUTION:</u></strong> Leading and trailing spaces around an inventory tag are
not considered part of the tag.  Within a tag, every non-graphical
character is replaced by <code>_</code>
.  For example, you write the that tag:
</p><pre>
        `main' for the hello    world program

</pre>
<p>the actual inventory tag is:
</p><pre>
        `main'_for_the_hello____world_program

</pre>
<p>It is possible that a future release of <code>arch</code>
 will slightly change
the rule -- so that multiple spaces and tabs are replaced by a single
<code>_</code>
.
</p>










<hr>

<a name="Recognizing_Renames_--_Inventory_Tags"></a>



<h3 align=center>Recognizing Renames -- Inventory Tags</h3>




<small>
<b>up: </b><a href="inventory.html#arch_Project_Inventories">arch Project Inventories</a></br>
<b>next: </b><a href="inventory.html#Keeping_Things_Neat_and_Tidy">Keeping Things Neat and Tidy</a></br>

<b>prev: </b><a href="inventory.html#Using_an_Implicit_Inventory">Using an Implicit Inventory</a></br>

</small>
<br>






<p><a name="index-pt:18"></a>

<a name="index-pt:19"></a>

</p><p>If you are using naming conventions only to recognize source files,
then if you rename a directory or file, <code>arch</code>
 will conclude that you
have deleted the old file, and created a new file.
</p><p>If you are using an explicit source inventory, <code>arch</code>
 will always
recognize when a directory is renamed (presuming that the <code>.arch_ids</code>

subdirectory is preserved), and it will recognize when a file is
renamed if you use <code>move</code>
 (rather than <code>delete</code>
 and <code>add</code>
).
Of course, <code>arch</code>
 can be fooled if you swap two files without swapping
their inventory tags.
</p><p>If you are using an implicit inventory, <code>arch</code>
 will never recognize
when an untagged file is renamed (it will think &quot;delete&quot; and
&quot;add&quot;).  If a file is tagged explicitly, <code>arch</code>
 will recognize when
the file is added, deleted, or renamed -- just as when using an
explicit inventory.  If a file is not tagged explicitly, but has an
embedded tag, <code>arch</code>
 will recognize when the file is added, deleted or
moved.
</p>










<hr>

<a name="Keeping_Things_Neat_and_Tidy"></a>



<h3 align=center>Keeping Things Neat and Tidy</h3>




<small>
<b>up: </b><a href="inventory.html#arch_Project_Inventories">arch Project Inventories</a></br>
<b>next: </b><a href="inventory.html#Avoiding_Accidental_Ommissions_and_Additions">Avoiding Accidental Ommissions and Additions</a></br>

<b>prev: </b><a href="inventory.html#Recognizing_Renames_--_Inventory_Tags">Recognizing Renames -- Inventory Tags</a></br>

</small>
<br>






<p><a name="index-pt:20"></a>

</p><p>The command:
</p><pre>
        % larch tree-lint

</pre>
<p>is useful for keeping things neat and tidy.
</p><p>If you use explicit tagging, it will tell you of any tags for which
the corresponding file does not exist.  It will tell you of any files
that pass the naming conventions, but for which no explicit tag
exists.
</p><p>If you use implicit tagging, it will tell you of any files for which
no tag can be found -- either explicit or implicit.  It will tell you
of any explicit tags for which the corresponding file does not exist.
</p><p>In either case, or if you are using naming conventions only,
<code>tree-lint</code>
 will tell you of any files that don't fit the naming
conventions at all.
</p><p>Finally, if you use explicit or implicit tagging, <code>tree-lint</code>
 will
check for cases where multiple files use the same tag.  If any two
files do have the same tag, you <strong>must</strong> correct that, either by
editting the tag (if it is in the file itself) or by using <code>delete</code>

and <code>add</code>
 to replace a duplicated explicit tag.
</p>










<hr>

<a name="Avoiding_Accidental_Ommissions_and_Additions"></a>



<h3 align=center>Avoiding Accidental Ommissions and Additions</h3>




<small>
<b>up: </b><a href="inventory.html#arch_Project_Inventories">arch Project Inventories</a></br>
<b>next: </b><a href="inventory.html#The_Inventory_Tag_Abstraction_in_Detail">The Inventory Tag Abstraction in Detail</a></br>

<b>prev: </b><a href="inventory.html#Keeping_Things_Neat_and_Tidy">Keeping Things Neat and Tidy</a></br>

</small>
<br>






<p><a name="index-pt:21"></a>

<a name="index-pt:22"></a>

<a name="index-pt:23"></a>

</p><p>A <em>
<a name="index-pt:24"></a>

manifest
</em>
 is an explicit list of the files you believe are
<strong>supposed</strong> to be in a project tree.  <code>arch</code>
 allows you to maintain a
manifest, and to compare it to the actual contents of a tree.
</p><p>The command <code>set-manifest</code>
 sets the manifest to the current contents
of the project tree:
</p><pre>
        % larch set-manifest

</pre>
<p>Note that only regular source files, not <code>arch</code>
 control files, are
included in the manifest.  To replace an existing manifest, you must
provide the <code>-f</code>
 flag (or <code>--force</code>
) to <code>set-manifest</code>
.
</p><p>You can retrieve the manifest with:
</p><pre>
        % larch manifest

</pre>
<p>Each line of the manifest is of the form:
</p><pre>
        &lt;path>\t&lt;tag>

</pre>
<p>and the list is sorted by the <code>&lt;tag></code>
 field.
</p><p>You can look for missing, added, or renamed files with:
</p><pre>
        % larch check-manifest

</pre>
<p>which will compare the project tree inventory to the manifest and
print a report describing divergences (if there are any).
</p>










<hr>

<a name="The_Inventory_Tag_Abstraction_in_Detail"></a>



<h3 align=center>The Inventory Tag Abstraction in Detail</h3>




<small>
<b>up: </b><a href="inventory.html#arch_Project_Inventories">arch Project Inventories</a></br>
<b>next: </b><a href="inventory.html#A_Warning_About_Changing_Tagging_Methods">A Warning About Changing Tagging Methods</a></br>

<b>prev: </b><a href="inventory.html#Avoiding_Accidental_Ommissions_and_Additions">Avoiding Accidental Ommissions and Additions</a></br>

</small>
<br>






<p>When <code>arch</code>
 considers the files and directories in a working directory
it builds a one-to-one index mapping path names (relative to the root
of the working directory tree) to <em>
<a name="index-pt:25"></a>

inventory tags
</em>
.
</p><p>The inventory tag of a file is its &quot;logical identity&quot;.  The path is
the position of that identity within the particular working dir.
</p><p>You can see the inventory tag for each source file with the command:
</p><pre>
        % larch inventory --source --tags

</pre>
<p>When <code>arch</code>
 compares two project trees, it bases the comparison on
logical identities.  If both trees have a file with a particular
inventory tag, but the files are in different positions, then <code>arch</code>

considers the file to have been moved or renamed.  Similarly, if an
inventory tag is present in one tree, but missing in the other, then
<code>arch</code>
 considers the file to have been added or deleted.
</p><p>If you use naming conventions only, the inventory tag of each file is
the same as its path.  Thus, when using the <code>names</code>
 tagging method,
<code>arch</code>
 never recognizes that a file has been moved or renamed.
</p><p>When you use the <code>explicit</code>
 tagging method, inventory tags are stored
in the <code>.arch-ids</code>
 directories.  There is a file in <code>.arch-ids</code>
 for
each tagged file (and one file for the directory containing
<code>.arch-ids</code>
), and those files contain the tags.
</p><p>When you use the <code>implicit</code>
 tagging method, tags in <code>.arch-ids</code>

directories take precedence (if they exist).  If a file is not
explicitly tagged, <code>arch</code>
 searches for the inventory tag in the file
itself (as described earlier in the chapter).  Finally, if a file is
not tagged at all, then its path is used as the inventory tag.
</p>










<hr>

<a name="A_Warning_About_Changing_Tagging_Methods"></a>



<h3 align=center>A Warning About Changing Tagging Methods</h3>




<small>
<b>up: </b><a href="inventory.html#arch_Project_Inventories">arch Project Inventories</a></br>
<b>next: </b><a href="inventory.html#Other_Ways_to_Tag_Files">Other Ways to Tag Files</a></br>

<b>prev: </b><a href="inventory.html#The_Inventory_Tag_Abstraction_in_Detail">The Inventory Tag Abstraction in Detail</a></br>

</small>
<br>






<p>Be cautious when changing tagging methods for directories already
checked-in to an <code>arch</code>
 revision control archive.
</p><p>For example, if you change from the tagging method <code>names</code>
 to
<code>explicit</code>
, then the inventory tag for every file will change.  <code>arch</code>

will think that you've deleted all of the files in the old tree, and
added all of the files in the new tree.
</p><p>However, there is a work-around for this problem, described in a later
chapter.
</p>










<hr>

<a name="Other_Ways_to_Tag_Files"></a>



<h3 align=center>Other Ways to Tag Files</h3>




<small>
<b>up: </b><a href="inventory.html#arch_Project_Inventories">arch Project Inventories</a></br>
<b>next: </b><a href="inventory.html#Telling_tree-lint_to_Shut_Up">Telling tree-lint to Shut Up</a></br>

<b>prev: </b><a href="inventory.html#A_Warning_About_Changing_Tagging_Methods">A Warning About Changing Tagging Methods</a></br>

</small>
<br>






<p><a name="index-pt:26"></a>

</p><p>In some situations, it isn't convenient to explicitly tag every file
or to add an implicit tag to every file.
</p><p>You can supply a <em>
<a name="index-pt:27"></a>

default tag
</em>
 for every file that doesn't have an
explicit tag with the command:
</p><pre>
        % larch explicit-default TAG-PREFIX

</pre>
<p>After that, every file in that directory which lacks an explicit tag
will have the tag:
</p><pre>
        TAG-PREFIX__BASENAME

</pre>
<p>where <code>BASENAME</code>
 is the basename of the file.  Default tags created in
this way take precedence over implicit tags embedded in files.  You
can find out the default tag for a directory with:
</p><pre>
        % larch explicit-default
        TAG-PREFIX

</pre>
<p>and remove the default with:
</p><pre>
        % larch explicit-default --delete

</pre>
<p>You can also specify a default tag which has <em>lower</em> precedence than
implicit tags:
</p><pre>
        % larch explicit-default --weak TAG-PREFIX

</pre>
<p>and view that default:
</p><pre>
        % larch explicit-default --weak

</pre>
<p>or delete it:
</p><pre>
        % larch explicit-default --weak --delete

</pre>











<hr>

<a name="Telling_tree-lint_to_Shut_Up"></a>



<h3 align=center>Telling tree-lint to Shut Up</h3>




<small>
<b>up: </b><a href="inventory.html#arch_Project_Inventories">arch Project Inventories</a></br>
<b>next: </b><a href="inventory.html#Which_Tagging_Method_Should_You_Use?">Which Tagging Method Should You Use?</a></br>

<b>prev: </b><a href="inventory.html#Other_Ways_to_Tag_Files">Other Ways to Tag Files</a></br>

</small>
<br>






<p><a name="index-pt:28"></a>

<a name="index-pt:29"></a>

</p><p>When using implicit tags, you may sometimes have a directory with many
files that have no tag (either explicit or implicit), but not want
those files to appear in a report of untagged files generated by
<code>tree-lint</code>
.  There are two ways to tell <code>tree-lint</code>
 to shut-up
about such files:
</p><p>One is to provide a default explicit tag or weak default explicit tag
using <code>larch explicit-default</code>
, as described above.  
</p><p>The second method is to label the directory as &quot;don't care&quot;
directory -- which means that <code>tree-lint</code>
 shouldn't complain about
untagged files.  You can do that with:
</p><pre>
        % larch explicit-default --dont-care set

</pre>
<p>or remove the &quot;don't care&quot; flag with:
</p><pre>
        % larch explicit-default --delete --dont-care

</pre>
<p>You can find out whether the &quot;don't care&quot; flag is set in a given
directory with:
</p><pre>
        % larch explicit-default --dont-care

</pre>











<hr>

<a name="Which_Tagging_Method_Should_You_Use?"></a>



<h3 align=center>Which Tagging Method Should You Use?</h3>




<small>
<b>up: </b><a href="inventory.html#arch_Project_Inventories">arch Project Inventories</a></br>
<b>next: </b><a href="inventory.html#Altering_the_Naming_Conventions">Altering the Naming Conventions</a></br>

<b>prev: </b><a href="inventory.html#Telling_tree-lint_to_Shut_Up">Telling tree-lint to Shut Up</a></br>

</small>
<br>






<p>Given the choice of the <code>names</code>
, <code>explicit</code>
, and <code>implicit</code>
 tagging
conventions, which one should you choose?
</p><p>The <code>names</code>
 method is best for project trees that you don't control,
and for which the maintainer does not include file tags (either
explicit or implicit).  For such trees, the <code>names</code>
 method will always
work, but if you want to use the <code>explicit</code>
 or <code>implicit</code>
 method,
you'll have to add file tags yourself.
</p><p>The <code>implicit</code>
 method is, in my opinion, by far the most convenient.
It is easy to get in the habit of adding a <code>tag:</code>
 line to the bottom
of each new file and doing a single <code>larch add</code>
 for each directory.
After those steps, you can rename files and directories freely --
without having to remember to tell <code>arch</code>
 in a separate command.
</p><p>On the other hand, the <code>implicit</code>
 method has two limitations.  One
limitation is that you must accept the possibility of accidently
adding new files to the inventory.  Any file you create that passes
the naming conventions counts as source.  The other, closely related,
limitation is that if you use <code>implicit</code>
 inventories, you will
<strong>never</strong> want to compile a program in its own source directory.  When
you compile a program, that creates intermediate files and
executables.  Many of those files will almost certainly pass the
naming conventions for source -- so <code>arch</code>
 will wrongly include them
in a source inventory.  I use the <code>implicit</code>
 method, but my
<code>configure</code>
 scripts have a safeguard that causes them to refuse to
compile my programs in the source tree.
</p><p>Finally, the <code>explicit</code>
 method is the only choice left if you want the
benefits of real file tags (therefore you can't use the <code>names</code>

method) but either insist on compiling in the source tree or can't
risk accidently adding the occasional unintended file (so you
shouldn't use <code>implicit</code>
).
</p>










<hr>

<a name="Altering_the_Naming_Conventions"></a>



<h3 align=center>Altering the Naming Conventions</h3>




<small>
<b>up: </b><a href="inventory.html#arch_Project_Inventories">arch Project Inventories</a></br>

<b>prev: </b><a href="inventory.html#Which_Tagging_Method_Should_You_Use?">Which Tagging Method Should You Use?</a></br>

</small>
<br>






<p><strong><u>Note:</u></strong> this is a relatively new feature, so the documentation is not
yet well integrated with the rest of the manual.
</p><p>The file <code>{arch}/=tagging-method</code>
 defines the naming conventiosn used
for a particular project tree.  By editting that file, you can
estalish naming conventions that are different from the defaults,
which are described above.
</p><p>That file can contain blank lines and comments (lines beginning with
<em>
<a name="index-pt:30"></a>

#
</em>
) and directives, one per line.  The permissable directives are:
</p><pre>
        implicit
        explicit
        names
                specify the tagging method to use for this tree

</pre>
<pre>
        exclude RE
        junk RE
        backup RE
        precious RE
        unrecognized RE
        source RE
                specify a regular expression to use for the indicated
                category of files.

</pre>
<p>Regular expressions are specified in Posix ERE syntax (the same syntax
used by <em>
<a name="index-pt:31"></a>

egrep
</em>
, <em>
<a name="index-pt:32"></a>

grep -E
</em>
, and <em>
<a name="index-pt:33"></a>

awk
</em>
) and have default values which
implement the naming conventions described above.
</p><p>The <code>exclude</code>
 pattern should match a subset of files matched by the
<code>source</code>
 pattern.  Files which match <code>exclude</code>
 are printed by:
</p><pre>
        % larch inventory --source --all

</pre>
<p>but not printed by:
</p><pre>
        % larch inventory --source

</pre>
<p>Although you can define your own naming conventions, there are some
minor limitations:
</p><p>The file names <code>.</code>
 and <code>..</code>
 are always ignored by <code>inventory</code>
.
</p><p>File names which contain non-printing characters, spaces, or any of
the globbing characters (<code>*</code>
, <code>[</code>
, <code>]</code>
, <code>\</code>
, <code>?</code>
) are always placed
in the category <code>unrecognized</code>
.  This is so that tools which operate
on project trees can safely presume that no source file has a name
that includes these characters.
</p><p>File names which begin with <em>
<a name="index-pt:34"></a>

,,
</em>
 are always placed in the category
<code>junk</code>
.  This is so that tools which operate on a project tree can
safely destroy or create files beginning with <em>
<a name="index-pt:35"></a>

,,
</em>
.
</p><p>The default naming conventions are given by:
</p><pre>
       exclude ^(.arch-ids|\{arch\})$
       junk ^(,.*)$
       backup ^.*(~|\.~[0-9]+~|\.bak|\.orig|\.rej|\.original|\.modified|\.reject)$
       precious ^(\+.*|\.gdbinit|=build\.*|=install\.*|CVS|CVS\.adm|RCS|RCSLOG|SCCS|TAGS)$
       unrecognized ^(.*\.(o|a|so|core)|core)$
       source ^([_=a-zA-Z0-9].*|\.arch-ids|\{arch\}|\.arch-project-tree)$

</pre>



















<small><i>arch: The arch Revision Control System

</i></small><br>


<a href="http://www.regexps.com">The Hackerlab at <code>regexps.com</code></a>

</body>