Mercurial > hgbook
annotate ja/filenames.tex @ 835:8a3041e6f3cb
reflect comments by Hiroshi Someya.
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Sat, 11 Jul 2009 19:25:35 +0900 |
parents | 5276f40fca1c |
children |
rev | line source |
---|---|
364 | 1 %\chapter{File names and pattern matching} |
2 \chapter{$B%U%!%$%kL>$H%Q%?!<%s%^%C%A%s%0(B} | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
3 \label{chap:names} |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
4 |
364 | 5 %Mercurial provides mechanisms that let you work with file names in a |
6 %consistent and expressive way. | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
7 |
364 | 8 Mercurial$B$O%U%!%$%kL>$K$D$$$F0l4S@-$N$"$jJ,$+$j$d$9$$%a%+%K%:%`$rDs6!$9(B |
9 $B$k!%(B | |
10 | |
11 %\section{Simple file naming} | |
12 \section{$B%7%s%W%k$J%U%!%$%kL?L>(B} | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
13 |
364 | 14 %Mercurial uses a unified piece of machinery ``under the hood'' to |
15 %handle file names. Every command behaves uniformly with respect to | |
16 %file names. The way in which commands work with file names is as | |
17 %follows. | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
18 |
364 | 19 Mercurial$B$O%U%!%$%kL>$r<h$j07$&FbIt$N%a%+%K%:%`$r;}$C$F$$$k!%$"$i$f$k%3%^(B |
20 $B%s%I$O%U%!%$%kL>$KBP$7$FF10l$K$U$k$^$&!%%3%^%s%I$,%U%!%$%kL>$r07$&$d$jJ}(B | |
21 $B$r0J2<$K<($9!%(B | |
22 | |
23 %If you explicitly name real files on the command line, Mercurial works | |
24 %with exactly those files, as you would expect. | |
835
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
25 $B%3%^%s%I%i%$%s$K<B:]$N%U%!%$%kL>$rL@<(E*$KM?$($?;~$O!$(BMercurial$B$OM?$($i(B |
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
26 $B$l$?%U%!%$%k$@$1$r07$&!%(B |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
27 \interaction{filenames.files} |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
28 |
364 | 29 %When you provide a directory name, Mercurial will interpret this as |
30 %``operate on every file in this directory and its subdirectories''. | |
31 %Mercurial traverses the files and subdirectories in a directory in | |
32 %alphabetical order. When it encounters a subdirectory, it will | |
33 %traverse that subdirectory before continuing with the current | |
34 %directory. | |
35 | |
36 $B%G%#%l%/%H%jL>$rM?$($?>l9g$O!$(BMercurial$B$O(B``$B$3$N%G%#%l%/%H%j$H%5%V%G%#%l%/(B | |
37 $B%H%jFb$N$9$Y$F$N%U%!%$%k$KBP$7$F=hM}$r9T$&(B''$B$H2r<a$9$k!%(B | |
38 Mercurial$B$O%G%#%l%/%H%jFb$N%U%!%$%k$H%5%V%G%#%l%/%H%j$r%"%k%U%!%Y%C%H=g(B | |
39 $B$KEO$jJb$/!%%5%V%G%#%l%/%H%j$r8+$D$1$k$H!$%+%l%s%H%G%#%l%/%H%j$N=hM}$rB3(B | |
40 $B$1$k$N$G$O$J$/!$%5%V%G%#%l%/%H%jFb$r8+$K9T$/!%(B | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
41 \interaction{filenames.dirs} |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
42 |
364 | 43 %\section{Running commands without any file names} |
44 \section{$B%U%!%$%kL>$J$7$G%3%^%s%I$r<B9T$9$k(B} | |
45 | |
46 %Mercurial's commands that work with file names have useful default | |
47 %behaviours when you invoke them without providing any file names or | |
48 %patterns. What kind of behaviour you should expect depends on what | |
49 %the command does. Here are a few rules of thumb you can use to | |
50 %predict what a command is likely to do if you don't give it any names | |
51 %to work with. | |
52 | |
53 $B%U%!%$%kL>$r<h$k(BMercurial$B%3%^%s%I$O%U%!%$%kL>$d%Q%?!<%s$rM?$($J$$$G5/F0$7(B | |
54 $B$?>l9g$G$bM-MQ$J%G%U%)%k%H$N?6Iq$r;}$D!%4|BT$9$k5sF0$O!$2?$r$9$k%3%^%s%I(B | |
55 $B$+$K$h$k!%%3%^%s%I$K%U%!%$%kL>Ey$rM?$($J$+$C$?>l9g$K%3%^%s%I$,$I$N$h$&$K(B | |
56 $BF0$/$+?dB,$9$kBg$^$+$J%k!<%k$r$$$/$D$+5s$2$k!%(B | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
57 |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
58 \begin{itemize} |
364 | 59 %\item Most commands will operate on the entire working directory. |
60 % This is what the \hgcmd{add} command does, for example. | |
61 \item $BBgH>$N%3%^%s%I$O%o!<%-%s%0%G%#%l%/%H%jA4BN$KBP$7$FF/$/!%Nc$($P(B | |
62 \hgcmd{add}$B%3%^%s%I$N$U$k$^$$$,$3$l$K$"$?$k!%(B | |
63 | |
64 %\item If the command has effects that are difficult or impossible to | |
65 % reverse, it will force you to explicitly provide at least one name | |
66 % or pattern (see below). This protects you from accidentally | |
67 % deleting files by running \hgcmd{remove} with no arguments, for | |
68 % example. | |
835
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
69 \item $BI|85$,:$Fq$G$"$C$?$jIT2DG=$G$"$k$h$&$J8z2L$r;}$D%3%^%s%I$N>l9g!$:G(B |
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
70 $BDc(B1$B$D$NL>A0$d%Q%?!<%s$rL@<($9$k$3$H$r5a$a$k!J2<5-$r;2>H!%!K!%$3$&(B |
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
71 $B$9$k$3$H$G!$Nc$($P(B\hgcmd{remove}$B$K0z?t$rM?$($J$+$C$?$?$a$K%U%!%$%k(B |
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
72 $B$9$Y$F$r8m$C$F>C$9$3$H$,$J$/$J$k!%(B |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
73 \end{itemize} |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
74 |
364 | 75 %It's easy to work around these default behaviours if they don't suit |
76 %you. If a command normally operates on the whole working directory, | |
77 %you can invoke it on just the current directory and its subdirectories | |
78 %by giving it the name ``\dirname{.}''. | |
79 %\interaction{filenames.wdir-subdir} | |
80 | |
81 $B%G%U%)%k%H$N5sF0$,5$$KF~$i$J$$>l9g!$$3$l$rJQ99$9$k$N$O$?$d$9$$!%(B | |
82 $B%3%^%s%I$,DL>o%o!<%-%s%0%G%#%l%/%H%jA4BN$KBP$7$FF0:n$9$k$H$7$h$&!%(B | |
83 $B$3$l$r%+%l%s%H%G%#%l%/%H%j$H$=$N%5%V%G%#%l%/%H%j$KBP$7$F$N$_F0:n$9$k$h$&(B | |
84 $B$KJQ$($k$K$O!$(B``\dirname{.}''$B$rEO$;$PNI$$!%(B | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
85 \interaction{filenames.wdir-subdir} |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
86 |
364 | 87 %Along the same lines, some commands normally print file names relative |
88 %to the root of the repository, even if you're invoking them from a | |
89 %subdirectory. Such a command will print file names relative to your | |
90 %subdirectory if you give it explicit names. Here, we're going to run | |
91 %\hgcmd{status} from a subdirectory, and get it to operate on the | |
92 %entire working directory while printing file names relative to our | |
93 %subdirectory, by passing it the output of the \hgcmd{root} command. | |
94 %\interaction{filenames.wdir-relname} | |
95 | |
835
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
96 $B%5%V%G%#%l%/%H%j$+$i5/F0$7$F$b%U%!%$%kL>$r%j%]%8%H%j$N%k!<%H$+$i$NAjBP%Q(B |
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
97 $B%9$GI=<($9$k%3%^%s%I$,$"$k!%$=$N$h$&$J%3%^%s%I$KL@<(E*$K%5%V%G%#%l%/%H%j(B |
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
98 $BL>$rM?$($k$H!$8=:_$N%5%V%G%#%l%/%H%j$+$i$NAjBP%Q%9$,I=<($5$l$k!%$3$3$G!$(B |
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
99 $B%5%V%G%#%l%/%H%jFb$+$i(B\hgcmd{status}$B%3%^%s%I$K(B\hgcmd{root}$B%3%^%s%I$N=PNO(B |
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
100 $B$r0z?t$H$7$FM?$($F5/F0$7!$(B \hgcmd{status}$B%3%^%s%I$,%o!<%-%s%0%G%#%l%/%H%j(B |
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
101 $BFb$N%U%!%$%k$r8=:_$N%5%V%G%#%l%/%H%j$KBP$9$kAjBP%Q%9$GI=<($9$kMM;R$r8+$F(B |
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
102 $B$_$h$&!%(B |
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
103 \interaction{filenames.wdir-relname} |
364 | 104 |
105 | |
106 %\section{Telling you what's going on} | |
107 \section{$B2?$,5/$-$F$$$k$N$+(B} | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
108 |
364 | 109 %The \hgcmd{add} example in the preceding section illustrates something |
110 %else that's helpful about Mercurial commands. If a command operates | |
111 %on a file that you didn't name explicitly on the command line, it will | |
112 %usually print the name of the file, so that you will not be surprised | |
113 %what's going on. | |
114 | |
115 $BA0%;%/%7%g%s$N(B\hgcmd{add}$B$NNc$O(BMercurial$B%3%^%s%I$K$D$$$FJL$NM-MQ$J>pJs$r(B | |
116 $B<($7$F$$$k!%%3%^%s%I%i%$%s$GL@<(E*$KL>A0$r;XDj$7$J$+$C$?%U%!%$%k$KBP$7$F(B | |
117 $B%3%^%s%I=hM}$r9T$&>l9g!$%U%!%$%kL>$rI=<($7!$2?$,5/$3$C$F$$$k$N$+J,$+$i$J(B | |
118 $B$/$J$i$J$$$h$&$K$7$F$$$k!%(B | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
119 |
364 | 120 %The principle here is of \emph{least surprise}. If you've exactly |
121 %named a file on the command line, there's no point in repeating it | |
803 | 122 %back at you. If Mercurial is acting on a file \emph{implicitly}, e.g. |
364 | 123 %because you provided no names, or a directory, or a pattern (see |
803 | 124 %below), it is safest to tell you what it's operating on. |
364 | 125 |
126 \emph{$B$G$-$k$@$1$S$C$/$j$5$;$J$$(B}$B$H$$$&$N$,$3$3$G$N86B'$G$"$k!%%3%^%s%I%i(B | |
127 $B%$%s$G%U%!%$%kL>$r40A4$K;XDj$7$?>l9g!$%U%!%$%kL>$,I=<($5$l$k$3$H$O$J$$!%(B | |
803 | 128 Mercurial$B$O!$L>A0$rM?$($J$$$+!$%G%#%l%/%H%jL>$d!$0J2<$G@bL@$9$k$h$&$J%Q%?!<(B |
129 $B%s$rM?$(!$%U%!%$%k$,(B\emph{$B0EL[E*$K(B}$B;XDj$5$l$?>l9g$O!$0BA4$N$?$a$K8=:_A`(B | |
130 $B:n$7$F$$$k%U%!%$%kL>$rI=<($9$k!%(B | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
131 |
364 | 132 %For commands that behave this way, you can silence them using the |
133 %\hggopt{-q} option. You can also get them to print the name of every | |
134 %file, even those you've named explicitly, using the \hggopt{-v} | |
135 %option. | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
136 |
364 | 137 $B$3$N$h$&$K?6Iq$&%3%^%s%I$r!$(B\hggopt{-q}$B%*%W%7%g%s$rM?$($k$3$H$GD@L[$5$;$k(B |
138 $B$3$H$b$G$-$k!%5U$KL@<(E*$K;XDj$7$?%U%!%$%k$X$NF0:n$G$"$C$F$b(B\hggopt{-v}$B%*(B | |
139 $B%W%7%g%s$rM?$($k$3$H$G$9$Y$F$N%U%!%$%kL>$rI=<($5$;$k$3$H$b$G$-$k!%(B | |
140 | |
141 %\section{Using patterns to identify files} | |
142 \section{$B%U%!%$%kL><1JL$K%Q%?!<%s$rMQ$$$k(B} | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
143 |
364 | 144 %In addition to working with file and directory names, Mercurial lets |
145 %you use \emph{patterns} to identify files. Mercurial's pattern | |
146 %handling is expressive. | |
147 | |
148 $B%U%!%$%k$d%G%#%l%/%H%jL>$r;H$C$?F0:n$NB>$K!$(BMercurial$B$G$O(B\emph{patterns} | |
149 $B$r;H$C$F%U%!%$%k$r<1JL$9$k$3$H$b$G$-$k!%(BMercurial$B$N%Q%?!<%s=hM}$O6/NO$G(B | |
150 $B$"$k!%(B | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
151 |
364 | 152 %On Unix-like systems (Linux, MacOS, etc.), the job of matching file |
153 %names to patterns normally falls to the shell. On these systems, you | |
154 %must explicitly tell Mercurial that a name is a pattern. On Windows, | |
155 %the shell does not expand patterns, so Mercurial will automatically | |
156 %identify names that are patterns, and expand them for you. | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
157 |
364 | 158 Unix$B7O$N%7%9%F%`(B(Linux, MacOS$BEy(B)$B$G$O%U%!%$%kL>$H%Q%?!<%s$r%^%C%A$5$;$k;E(B |
159 $B;v$O%7%'%k$KG$$5$l$k!%$3$l$i$N%7%9%F%`$G$O!$L>A0$,%Q%?!<%s$G$"$k$3$H$rL@(B | |
160 $B<(E*$K(BMercurial$B$K<($5$J$1$l$P$J$i$J$$!%(B Windows$B$G$O%7%'%k$O%Q%?!<%s$rE83+(B | |
161 $B$7$J$$$N$G!$(BMercurial$B$OM?$($i$l$?L>A0$,<+F0E*$K%Q%?!<%s$G$"$k$3$H$rG'<1(B | |
162 $B$7!$E83+$9$k!%(B | |
163 | |
164 %To provide a pattern in place of a regular name on the command line, | |
165 %the mechanism is simple: | |
166 | |
167 $B%3%^%s%I%i%$%s$GDL>o$NL>A0$NBe$o$j$K%Q%?!<%s$rEO$9$?$a$N%a%+%K%:%`$O%7%s(B | |
168 $B%W%k$G$"$k!%(B: | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
169 \begin{codesample2} |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
170 syntax:patternbody |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
171 \end{codesample2} |
364 | 172 %That is, a pattern is identified by a short text string that says what |
173 %kind of pattern this is, followed by a colon, followed by the actual | |
174 %pattern. | |
175 | |
176 $B$I$N$h$&$J%Q%?!<%s$J$N$+$r<1JL$9$k$?$a$NC;$$%F%-%9%H$N8e$m$K%3%m%s$r64$s(B | |
177 $B$G<B:]$N%Q%?!<%s$,B3$/!%(B | |
178 | |
179 %Mercurial supports two kinds of pattern syntax. The most frequently | |
180 %used is called \texttt{glob}; this is the same kind of pattern | |
181 %matching used by the Unix shell, and should be familiar to Windows | |
182 %command prompt users, too. | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
183 |
364 | 184 Mercurial$B$O(B2$BDL$j$N%Q%?!<%s9=J8$r%5%]!<%H$9$k!%:G$b$h$/;H$o$l$k$N$O(B |
185 \texttt{glob};$B$G!$(BUnix$B%7%'%k$,%Q%?!<%s%^%C%A%s%0$K;HMQ$7$F$$$k$b$N$HF1MM(B | |
186 $B$N%Q%?!<%s$G$"$j!$$3$l$O(BWindows$B$N%3%^%s%I%W%m%s%W%H%f!<%6$K$H$C$F$b?F$7(B | |
187 $B$_?<$$$b$N$G$"$k!%(B | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
188 |
364 | 189 %When Mercurial does automatic pattern matching on Windows, it uses |
190 %\texttt{glob} syntax. You can thus omit the ``\texttt{glob:}'' prefix | |
191 %on Windows, but it's safe to use it, too. | |
192 | |
193 Mercurial$B$O(BWindows$B$G$O<+F0E*$K%Q%?!<%s%^%C%A%s%0$r9T$&$H$-(B | |
194 $B$O!$(B\texttt{glob}$B9=J8$rMQ$$$k!%=>$C$F(BWindows$B$G$O(B``\texttt{glob:}''$B%W%l%U%#(B | |
195 $B%/%9$r>JN,$7$F$b0BA4$G$"$k!%(B | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
196 |
364 | 197 %The \texttt{re} syntax is more powerful; it lets you specify patterns |
198 %using regular expressions, also known as regexps. | |
199 | |
200 \texttt{re}$B9=J8$O$h$j6/NO$G!$@55,I=8=$rMQ$$$k$3$H$,$G$-$k!%(B | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
201 |
364 | 202 %By the way, in the examples that follow, notice that I'm careful to |
203 %wrap all of my patterns in quote characters, so that they won't get | |
204 %expanded by the shell before Mercurial sees them. | |
205 | |
206 $B8e$G<($9Nc$G$O!$(BMercurial$B$,8+$kA0$K%7%'%k$GE83+$5$l$k$N$rKI$0$?$a$K%Q%?!<(B | |
207 $B%s$r0zMQJ8;z$G$/$k$s$G$$$k$3$H$KCm0U$5$l$?$$!%(B | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
208 |
364 | 209 %\subsection{Shell-style \texttt{glob} patterns} |
210 \subsection{$B%7%'%k7A<0$N(B\texttt{glob}$B%Q%?!<%s(B} | |
211 | |
212 %This is an overview of the kinds of patterns you can use when you're | |
213 %matching on glob patterns. | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
214 |
364 | 215 glob$B%Q%?!<%s$G%^%C%A%s%0$r9T$&;~$K;H$($k%Q%?!<%s$N35N,$r<($9!%(B |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
216 |
364 | 217 %The ``\texttt{*}'' character matches any string, within a single |
218 %directory. | |
219 | |
220 ``\texttt{*}''$BJ8;z$O%G%#%l%/%H%jFb$NG$0U$NJ8;zNs$H%^%C%A$9$k!%(B | |
221 | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
222 \interaction{filenames.glob.star} |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
223 |
364 | 224 %The ``\texttt{**}'' pattern matches any string, and crosses directory |
225 %boundaries. It's not a standard Unix glob token, but it's accepted by | |
226 %several popular Unix shells, and is very useful. | |
227 %\interaction{filenames.glob.starstar} | |
228 | |
229 ``\texttt{**}''$B%Q%?!<%s$O%G%#%l%/%H%j$r1[$($FG$0U$NJ8;zNs$K%^%C%A$9$k!%$3(B | |
230 $B$l$O(BUnix$BI8=`$N(Bglob$B%H!<%/%s$G$O$J$$$,!$$$$/$D$+$N?M5$$N$"$k(BUnix$B%7%'%k$G;H(B | |
231 $B$&$3$H$,$G$-!$$H$F$bM-MQ$G$"$k!%(B | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
232 \interaction{filenames.glob.starstar} |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
233 |
364 | 234 %The ``\texttt{?}'' pattern matches any single character. |
235 %\interaction{filenames.glob.question} | |
236 | |
237 ``\texttt{?}''$B%Q%?!<%s$OG$0U$N(B1$BJ8;z$K%^%C%A$9$k!%(B | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
238 \interaction{filenames.glob.question} |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
239 |
364 | 240 %The ``\texttt{[}'' character begins a \emph{character class}. This |
241 %matches any single character within the class. The class ends with a | |
242 %``\texttt{]}'' character. A class may contain multiple \emph{range}s | |
243 %of the form ``\texttt{a-f}'', which is shorthand for | |
244 %``\texttt{abcdef}''. | |
245 | |
246 ``\texttt{[}''$BJ8;z$O(B\emph{$BJ8;z%/%i%9(B}$B$r3+;O$9$k!%$3$l$O%/%i%9Fb$NG$0U$N(B1 | |
247 $BJ8;z$K%^%C%A$9$k!%%/%i%9$O(B``\texttt{]}''$BJ8;z$G=*$k!%%/%i%9$O(B | |
248 ``\texttt{a-f}''$B$N$h$&$JHO0O$rJ#?t;}$D$3$H$,$G$-$k!%$3$NHO0O$O(B | |
249 ``\texttt{abcdef}''$B$NC;=L7A$KAjEv$9$k!%(B | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
250 \interaction{filenames.glob.range} |
364 | 251 |
252 %If the first character after the ``\texttt{[}'' in a character class | |
253 %is a ``\texttt{!}'', it \emph{negates} the class, making it match any | |
254 %single character not in the class. | |
255 | |
256 $BJ8;z%/%i%9$G(B``\texttt{[}''$B$N8e$K(B``\texttt{!}''$B$,Mh$?>l9g!$$3$l$O%/%i%9$N(B | |
257 $BH]Dj$H$J$j!$%/%i%9$K4^$^$l$J$$G$0U$N(B1$BJ8;z$H%^%C%A$9$k!%(B | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
258 |
364 | 259 %A ``\texttt{\{}'' begins a group of subpatterns, where the whole group |
260 %matches if any subpattern in the group matches. The ``\texttt{,}'' | |
261 %character separates subpatterns, and ``\texttt{\}}'' ends the group. | |
262 | |
263 ``\texttt{\{}''$B$O%5%V%Q%?!<%s$N%0%k!<%W$r3+;O$9$k!%%0%k!<%W$G$O!$%0%k!<%W(B | |
264 $BFb$NG$0U$N%5%V%Q%?!<%s$,%^%C%A$9$l$P%0%k!<%WA4BN$,%^%C%A$7$?$3$H$K$J$k!%(B | |
265 ``\texttt{,}''$BJ8;z$O%5%V%Q%?!<%s$rJ,N%$7!$(B``\texttt{\}}''$B$O%0%k!<%W$r=*N;(B | |
266 $B$9$k!%(B | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
267 \interaction{filenames.glob.group} |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
268 |
364 | 269 %\subsubsection{Watch out!} |
270 \subsubsection{$B$3$3$KCm0U!*(B} | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
271 |
364 | 272 %Don't forget that if you want to match a pattern in any directory, you |
273 %should not be using the ``\texttt{*}'' match-any token, as this will | |
274 %only match within one directory. Instead, use the ``\texttt{**}'' | |
275 %token. This small example illustrates the difference between the two. | |
276 | |
277 $BG$0U$N%G%#%l%/%H%j$G%Q%?!<%s$r%^%C%A$5$;$k>l9g!$(B``\texttt{*}''$B$rA4$F$H%^%C(B | |
278 $B%A$9$k%H!<%/%s$H$7$F;H$&$3$H$O$G$-$J$$!%$3$NJ8;z$O(B1$B$D$N%G%#%l%/%H%jFb$G$N(B | |
279 $B$_%^%C%A$9$k!%$=$NBe$o$j!$(B``\texttt{**}''$B%H!<%/%s$r;H$&!%$3$l$i$N0c$$$r@b(B | |
280 $BL@$9$k$?$a$KNc$r<($9!%(B | |
281 | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
282 \interaction{filenames.glob.star-starstar} |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
283 |
364 | 284 %\subsection{Regular expression matching with \texttt{re} patterns} |
285 \subsection{\texttt{re}$B%Q%?!<%s$r;H$C$?@55,I=8=%^%C%A(B} | |
286 | |
287 %Mercurial accepts the same regular expression syntax as the Python | |
288 %programming language (it uses Python's regexp engine internally). | |
289 %This is based on the Perl language's regexp syntax, which is the most | |
290 %popular dialect in use (it's also used in Java, for example). | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
291 |
364 | 292 Mercurial$B$O(BPython$B8@8l$HF1$8@55,I=8=9=J8$r<u$1IU$1$k!%!J(BMercurial$B$OFbIt$G(B |
293 Python$B$N@55,I=8=%(%s%8%s$r;H$C$F$$$k!%!K$3$l$O(BPerl$B$N(Bregexp$B9=J8$r85$K$7$F(B | |
294 $B$$$k!%$3$N9=J8$O:G$b$h$/MQ$$$i$l$F$$$k$b$N$G$"$j!$$?$H$($P(BJava$B$G$bMxMQ$5(B | |
295 $B$l$F$$$k!%(B | |
296 | |
297 %I won't discuss Mercurial's regexp dialect in any detail here, as | |
298 %regexps are not often used. Perl-style regexps are in any case | |
299 %already exhaustively documented on a multitude of web sites, and in | |
300 %many books. Instead, I will focus here on a few things you should | |
301 %know if you find yourself needing to use regexps with Mercurial. | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
302 |
364 | 303 regexp$B$,$=$l$[$I;H$o$l$F$$$J$$$+$N$h$&$K$3$3$G(BMercurial$B$N(Bregexp$B9=J8$K$D$$(B |
304 $B$F5DO@$9$k$3$H$OHr$1$k!%(B Perl$B%9%?%$%k(Bregexp$B$O$9$G$KB?$/$N%&%'%V%5%$%H$d=q(B | |
305 $B@R$G$G>\:Y$KEO$C$F@bL@$5$l$F$$$k!%$=$NBe$o$j!$$3$3$G$O(BMercurial$B$G(Bregexp$B$r(B | |
306 $B;H$&:]$KCN$C$F$*$/$Y$-$$$/$D$+$NE@$K>GE@$rEv$F$k$3$H$K$9$k!%(B | |
307 | |
308 %A regexp is matched against an entire file name, relative to the root | |
309 %of the repository. In other words, even if you're already in | |
310 %subbdirectory \dirname{foo}, if you want to match files under this | |
311 %directory, your pattern must start with ``\texttt{foo/}''. | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
312 |
364 | 313 regexp$B$O%U%!%$%kL>A4BN$H%^%C%A$9$k$,!$%U%!%$%kL>$O%j%]%8%H%j$N%k!<%H$+$i(B |
314 $B$NAjBP%Q%9$GI=$5$l$k!%8@$$BX$($l$P!$$9$G$K%5%V%G%#%l%/%H%j(B\dirname{foo}$B$K(B | |
315 $B$$$k$H$7$F!$$3$N%G%#%l%/%H%jFb$N%U%!%$%k$K%^%C%A$5$;$?$1$l(B | |
316 $B$P!$(B``\texttt{foo/}''$B$G;O$^$k%Q%?!<%s$rEO$9I,MW$,$"$k!%(B | |
317 | |
318 %One thing to note, if you're familiar with Perl-style regexps, is that | |
319 %Mercurial's are \emph{rooted}. That is, a regexp starts matching | |
320 %against the beginning of a string; it doesn't look for a match | |
321 %anywhere within the string. To match anywhere in a string, start | |
322 %your pattern with ``\texttt{.*}''. | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
323 |
364 | 324 Perl$B7A<0$N(Bregexp$B$K47$l$F$$$k$N$J$i!$(BMercurial$B$N(Bregexp$B$O(B\emph{root}$B$r;}$D(B |
325 $B$H$$$&E@$KCm0U$7$F$*$/$H$h$$!%$9$J$o$A!$(Bregexp$B$OJ8;zNs$N;O$^$j$+$i%^%C%A(B | |
326 $B$7!$J8;zNs$NESCf$+$i$O%^%C%A$7$J$$!%J8;zNs$NESCf$+$i%^%C%A$5$;$?$$>l9g(B | |
327 $B$O!$%Q%?!<%s$r(B``\texttt{.*}''$B$G;O$a$kI,MW$,$"$k!%(B | |
328 | |
329 %\section{Filtering files} | |
330 \section{$B%U%!%$%k$r%U%#%k%?$9$k(B} | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
331 |
364 | 332 %Not only does Mercurial give you a variety of ways to specify files; |
333 %it lets you further winnow those files using \emph{filters}. Commands | |
334 %that work with file names accept two filtering options. | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
335 |
364 | 336 Mercurial$B$O%U%!%$%k$r;XDj$9$kMM!9$JJ}K!$rDs6!$9$k$@$1$G$J$/!$$5$i$K(B |
337 \emph{$B%U%#%k%?(B}$B$K$h$C$F%U%!%$%k$rA*JL$9$kJ}K!$rDs6!$9$k!%%U%!%$%kL>$r<h$C(B | |
338 $B$FF0:n$9$k%3%^%s%I$O(B2$B$D$N%U%#%k%?%*%W%7%g%s$r<u$1IU$1$k!%(B | |
339 | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
340 \begin{itemize} |
364 | 341 %\item \hggopt{-I}, or \hggopt{--include}, lets you specify a pattern |
342 % that file names must match in order to be processed. | |
343 \item \hggopt{-I}$B$^$?$O(B\hggopt{--include}$B%*%W%7%g%s$G;XDj$7$?%Q%?!<%s$K(B | |
344 $B%^%C%A$7$?%U%!%$%k$,=hM}$5$l$k!%(B | |
345 %\item \hggopt{-X}, or \hggopt{--exclude}, gives you a way to | |
346 % \emph{avoid} processing files, if they match this pattern. | |
347 \item \hggopt{-X}$B$^$?$O(B\hggopt{--exclude}$B%*%W%7%g%s$G;XDj$7$?%Q%?!<%s$K(B | |
348 $B%^%C%A$7$?%U%!%$%k$O=hM}$+$i=|30$5$l$k!%(B | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
349 \end{itemize} |
364 | 350 |
351 %You can provide multiple \hggopt{-I} and \hggopt{-X} options on the | |
352 %command line, and intermix them as you please. Mercurial interprets | |
353 %the patterns you provide using glob syntax by default (but you can use | |
354 %regexps if you need to). | |
355 | |
356 $B%3%^%s%I%i%$%s$GJ#?t$N(B\hggopt{-I}$B$*$h$S(B\hggopt{-X}$B%*%W%7%g%s$r;XDj$7!$=j(B | |
357 $BK>$NAH9g$;$K$9$k$3$H$,$G$-$k!%(B Mercurial$B$O%G%U%)%k%H$G$O(Bglob$B9=J8$GM?$($?(B | |
358 $B%Q%?!<%s$r2r<a$9$k$,!$@55,I=8=$r;H$&$3$H$b2DG=$G$"$k!%(B | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
359 |
364 | 360 %You can read a \hggopt{-I} filter as ``process only the files that |
361 %match this filter''. | |
362 | |
363 \hggopt{-I}$B%U%#%k%?$O(B``$B$3$N%U%#%k%?$K%^%C%A$9$k%U%!%$%k$@$1$r=hM}$9$k(B'' | |
364 $B$HFI$_BX$($k$3$H$,$G$-$k!%(B | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
365 \interaction{filenames.filter.include} |
364 | 366 |
367 %The \hggopt{-X} filter is best read as ``process only the files that | |
368 %don't match this pattern''. | |
369 | |
370 \hggopt{-X}$B%U%#%k%?$O(B``$B$3$N%Q%?!<%s$K%^%C%A$7$J$$%U%!%$%k$@$1$r=hM}$9$k(B''$B$H(B | |
371 $BFI$_BX$($k$N$,:G$bAj1~$7$$!%(B | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
372 \interaction{filenames.filter.exclude} |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
373 |
803 | 374 |
375 %\section{Permanently ignoring unwanted files and directories} | |
376 \section{$BITI,MW$J%U%!%$%k$d%G%#%l%/%H%j$r1J5WE*$KL5;k$9$k(B} | |
377 | |
378 %When you create a new repository, the chances are that over time it will | |
379 %grow to contain files that ought to \emph{not} be managed by Mercurial, | |
380 %but which you don't want to see listed every time you run | |
381 %\hgcmd{status}. For instance, ``build products'' are files that are | |
382 %created as part of a build but which should not be managed by a revision | |
383 %control system. The most common build products are output files | |
384 %produced by software tools such as compilers. As another example, many | |
385 %text editors litter a directory with lock files, temporary working | |
386 %files, and backup files, which it also makes no sense to manage. | |
387 | |
388 $B?7$7$$%j%]%8%H%j$r:n@.$7!$3+H/:n6H$rB3$1$k$H!$;~4V$N7P2a$H$H$b$K%S%k%I@8(B | |
389 $B@.J*$J$I$N$h$&$K%j%S%8%g%s4IM}%7%9%F%`$G4IM}$9$Y$-$G$J$$%U%!%$%k$,%j%]%8(B | |
390 $B%H%j$KB?$/4^$^$l$k$h$&$K$J$k!%(BMercurial$B$N4IM}30$K$"$k$3$l$i$N%U%!%$%k(B | |
391 $B$O!$(B\hgcmd{status}$B$r<B9T$9$k$H$$$A$$$A2hLL$KI=<($5$l$F$7$^$&!%:G$bE57?E*(B | |
392 $B$J%S%k%I@8@.J*$O!$%3%s%Q%$%i$J$I$N%D!<%k$G@8@.$5$l$k=PNO%U%!%$%k$G$"$k!%(B | |
393 $B$=$NB>$K$O!$B?$/$N%F%-%9%H%(%G%#%?$,%G%#%l%/%H%j$KCV$/%m%C%/%U%!%$%k$d!$(B | |
394 $B0l;~E*$J%o!<%-%s%0%U%!%$%k!$%P%C%/%"%C%W%U%!%$%k$J$I$,$"$k!%(B | |
395 | |
396 %To have Mercurial permanently ignore such files, create a file named | |
397 %\filename{.hgignore} in the root of your repository. You \emph{should} | |
398 %\hgcmd{add} this file so that it gets tracked with the rest of your | |
399 %repository contents, since your collaborators will probably find it | |
400 %useful too. | |
401 | |
402 Mercurial$B$K$3$l$i$r1J5WE*$KL5;k$5$;$k$?$a$K$O!$%j%]%8%H%j$N%k!<%H%G%#%l%/(B | |
403 $B%H%j$K(B\filename{.hgignore}$B$H$$$&L>A0$N%U%!%$%k$r:n@.$9$k!%$3$N%U%!%$%k$O(B | |
404 $B$*$=$i$/B>$N6(NO<TC#$K$H$C$F$bM-MQ$G$"$k$+$i!$%j%]%8%H%j$NB>$N;D$j$NItJ,(B | |
405 $B$HF1MM$K4IM}$5$l$k$h$&!$(B \hgcmd{add}$B$9$Y$-$G$"$k!%(B | |
406 | |
407 %By default, the \filename{.hgignore} file should contain a list of | |
408 %regular expressions, one per line. Empty lines are skipped. Most people | |
409 %prefer to describe the files they want to ignore using the ``glob'' | |
410 %syntax that we described above, so a typical \filename{.hgignore} file | |
411 %will start with this directive: | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
412 |
803 | 413 $B%G%U%)%k%H$G$O(B\filename{.hgignore}$B%U%!%$%k$O(B1$B9T$K(B1$B$D$:$D@55,I=8=$N%j%9%H(B |
414 $B$r<u$1IU$1$k$h$&$K$J$C$F$$$k!%6u9T$OL5;k$5$l$k!%KX$s$I$N%f!<%6$OL5;k$9$Y(B | |
415 $B$-%U%!%$%k$rA0=R$N(B``glob''$B9=J8$rMQ$$$F5-=R$9$k$3$H$r9%$`$N$G!$(B | |
416 \filename{.hgignore}$B$N:G=i$O<!$N$h$&$J%G%#%l%/%F%#%V$G;O$a$k!%(B | |
417 | |
418 \begin{codesample2} | |
419 syntax: glob | |
420 \end{codesample2} | |
421 | |
422 %This tells Mercurial to interpret the lines that follow as glob | |
423 %patterns, not regular expressions. | |
424 | |
425 $B$3$l$O8eB3$N9T$r@55,I=8=$G$O$J$/(Bglob$B%Q%?!<%s$H$7$F2r<a$9$k$h$&(BMercurial$B$K(B | |
426 $B;X<($9$k!%(B | |
427 | |
428 %Here is a typical-looking \filename{.hgignore} file. | |
429 | |
430 $BE57?E*$J(B\filename{.hgignore}$B%U%!%$%k$NNc$r<($9!%(B | |
431 | |
432 \begin{codesample2} | |
433 syntax: glob | |
434 %# This line is a comment, and will be skipped. | |
435 %# Empty lines are skipped too. | |
436 # $B$3$N9T$O%3%a%s%H$G!$%9%-%C%W$5$l$k!%(B | |
437 # $B6u9T$bF1MM$K%9%-%C%W$5$l$k!%(B | |
438 | |
439 %# Backup files left behind by the Emacs editor. | |
440 # Emacs$B%(%G%#%?$K$h$C$F;D$5$l$k%P%C%/%"%C%W%U%!%$%k!%(B | |
441 *~ | |
442 | |
443 %# Lock files used by the Emacs editor. | |
444 %# Notice that the "#" character is quoted with a backslash. | |
445 %# This prevents it from being interpreted as starting a comment. | |
446 # Emacs$B%(%G%#%?$,;HMQ$9$k%m%C%/%U%!%$%k(B | |
447 # "#"$BJ8;z$,%P%C%/%9%i%C%7%e$G%(%9%1!<%W$5$l$F$$$k$3$H$KCm0U!%(B | |
448 # $B$3$l$K$h$C$F%3%a%s%H$N3+;OJ8;z$H$7$F2r<a$5$l$k$N$rKI$$$G$$$k!%(B | |
449 .\#* | |
450 | |
451 %# Temporary files used by the vim editor. | |
452 # vim$B%(%G%#%?$,;HMQ$9$k0l;~%U%!%$%k(B | |
453 .*.swp | |
454 | |
455 %# A hidden file created by the Mac OS X Finder. | |
456 # Mac OS X$B$N%U%!%$%s%@!<$K$h$C$F:n$i$l$k1#$7%U%!%$%k(B | |
457 .DS_Store | |
458 \end{codesample2} | |
459 | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
460 |
364 | 461 %\section{Case sensitivity} |
462 \section{$BBgJ8;z>.J8;z$N1F6A(B} | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
463 \label{sec:names:case} |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
464 |
364 | 465 %If you're working in a mixed development environment that contains |
466 %both Linux (or other Unix) systems and Macs or Windows systems, you | |
467 %should keep in the back of your mind the knowledge that they treat the | |
468 %case (``N'' versus ``n'') of file names in incompatible ways. This is | |
469 %not very likely to affect you, and it's easy to deal with if it does, | |
470 %but it could surprise you if you don't know about it. | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
471 |
364 | 472 Linux$B$r$O$8$a$H$9$k(BUnix$B$d(BMac$B!$(BWindows$B$,:.:_$9$k3+H/4D6-$G:n6H$r$7$F$$$k$N(B |
473 $B$J$i!$3F!9$N%7%9%F%`$O%U%!%$%kL>$N(B(``N''$B$H(B``n'')$B$N$h$&$JBg>.J8;z$r0[$J$C(B | |
474 $B$?$d$jJ}$G<h$j07$&$3$H$KN10U$9$Y$-$G$"$k!%$3$l$,LdBj$K$J$k$3$H$OLGB?$K$J(B | |
475 $B$/!$LdBj$K$J$k>l9g$G$b4JC1$K2r7h$G$-$k$,!$%7%9%F%`4V$G$N<h$j07$$$N0c$$$r(B | |
476 $BCN$i$J$1$l$P6C$/$3$H$K$J$k$@$m$&!%(B | |
477 | |
478 %Operating systems and filesystems differ in the way they handle the | |
479 %\emph{case} of characters in file and directory names. There are | |
480 %three common ways to handle case in names. | |
481 $B%*%Z%l!<%F%#%s%0%7%9%F%`$H%U%!%$%k%7%9%F%`$O!$%U%!%$%kL>$H%G%#%l%/%H%jL>(B | |
482 $B$N(B\emph{$BBg>.J8;z(B}$B$N07$$$G0[$J$C$F$$$k!%Bg>.J8;z$r07$&J}K!$O(B3$BDL$j$"$k!%(B | |
483 | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
484 \begin{itemize} |
364 | 485 %\item Completely case insensitive. Uppercase and lowercase versions |
486 % of a letter are treated as identical, both when creating a file and | |
487 % during subsequent accesses. This is common on older DOS-based | |
488 % systems. | |
489 \item $B40A4$KBg>.J8;z$r6hJL$7$J$$!%BgJ8;z$H>.J8;z$O!$%U%!%$%k$N:n@.$H$=(B | |
490 $B$N8e$N%"%/%;%9$GF10l$K07$o$l$k!%$3$l$O8E$$(BDOS$B%Y!<%9$N%7%9%F%`$GMQ(B | |
491 $B$$$i$l$F$$$?!%(B | |
492 | |
493 %\item Case preserving, but insensitive. When a file or directory is | |
494 % created, the case of its name is stored, and can be retrieved and | |
495 % displayed by the operating system. When an existing file is being | |
496 % looked up, its case is ignored. This is the standard arrangement on | |
497 % Windows and MacOS. The names \filename{foo} and \filename{FoO} | |
498 % identify the same file. This treatment of uppercase and lowercase | |
499 % letters as interchangeable is also referred to as \emph{case | |
500 % folding}. | |
501 \item $BBg>.J8;z$N0c$$$OJ]B8$5$l$k$,6hJL$5$l$J$$!%%U%!%$%k$d%G%#%l%/%H%j$,(B | |
502 $B:n$i$l$k$H!$%*%Z%l!<%F%#%s%0%7%9%F%`$OL>A0$NBg>.J8;z$rJ]B8$7!$I=<((B | |
503 $B$J$I$K;HMQ$9$k!%4{B8$N%U%!%$%k$,;2>H$5$l$k;~$O!$Bg>.J8;z$OL5;k$5$l(B | |
504 $B$k!%$3$l$O(BWindows$B$H(BMacOS$B$GI8=`E*$J<h$j07$$$G$"$k!%(B\filename{foo}$B$H(B | |
505 \filename{FoO}$B$OF10l$N%U%!%$%k$HG'<1$5$l$k!%$3$N$h$&$JBg>.J8;z$N<h(B | |
506 $B$j07$$$O(B\emph{case folding}$B$H8F$P$l$k$3$H$b$"$k!%(B | |
507 | |
508 %\item Case sensitive. The case of a name is significant at all times. | |
509 % The names \filename{foo} and {FoO} identify different files. This | |
510 % is the way Linux and Unix systems normally work. | |
511 \item $BBg>.J8;z$r6hJL$9$k!%>o$KBg>.J8;z$GL>A0$r6hJL$9$k!%(B\filename{foo} | |
512 $B$H(B{FoO}$B$OJL$N%U%!%$%k$HG'<1$5$l$k!%$3$l$O(BLinux$B$d(BUnix$B%7%9%F%`$NDL(B | |
513 $B>o$N<h$j07$$$G$"$k!%(B | |
514 | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
515 \end{itemize} |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
516 |
364 | 517 %On Unix-like systems, it is possible to have any or all of the above |
518 %ways of handling case in action at once. For example, if you use a | |
519 %USB thumb drive formatted with a FAT32 filesystem on a Linux system, | |
520 %Linux will handle names on that filesystem in a case preserving, but | |
521 %insensitive, way. | |
522 Unix$B7O$N%7%9%F%`$G$OF1;~$K>e5-$NJ}K!$rMxMQ$9$k$3$H$,2DG=$G$"$k!%Nc$($P(B | |
523 USB$B%a%b%j$r(BLinux$B$G(BFAT32$B%U%!%$%k%7%9%F%`$H$7$F%U%)!<%^%C%H$7$?>l9g!$(B | |
524 Linux$B$O$=$N%U%!%$%k%7%9%F%`>e$N%U%!%$%kL>$rBg>.J8;zJ]B8$@$,6hJL$;$:$K<h$j(B | |
525 $B07$&!%(B | |
526 | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
527 |
364 | 528 %\subsection{Safe, portable repository storage} |
529 \subsection{$B0BA4$G2DHB$J%j%]%8%H%j%9%H%l!<%8(B} | |
530 | |
531 %Mercurial's repository storage mechanism is \emph{case safe}. It | |
532 %translates file names so that they can be safely stored on both case | |
533 %sensitive and case insensitive filesystems. This means that you can | |
534 %use normal file copying tools to transfer a Mercurial repository onto, | |
535 %for example, a USB thumb drive, and safely move that drive and | |
536 %repository back and forth between a Mac, a PC running Windows, and a | |
537 %Linux box. | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
538 |
364 | 539 Mercurial$B$N%j%]%8%H%j3JG<%a%+%K%:%`$O(B\emph{$BBg>.J8;z%;!<%U(B}$B$G$"$k!%(B |
540 Mercurial$B$OBg>.J8;z$N6hJL$r$9$k%7%9%F%`$G$b$7$J$$%7%9%F%`$G$b0BA4$KJ]B8$G(B | |
541 $B$-$k$h$&$K%U%!%$%kL>$rJQ49$9$k!%$3$N$?$a!$DL>o$N%U%!%$%k%3%T!<%D!<%k$r;H$C(B | |
542 $B$F(BMercurial$B%j%]%8%H%j$r(BUSB$B%a%b%j$KE>Aw$7!$(BMac$B!$(BWindows$B$NF0$/(BPC$B!$(BLinux$B%^%7(B | |
543 $B%s$N4V$G0\F0$7$F$b0BA4$G$"$k!%(B | |
544 | |
545 | |
546 %\subsection{Detecting case conflicts} | |
547 \subsection{$BBgJ8;z>.J8;z$N>WFM$r8!=P$9$k(B} | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
548 |
364 | 549 %When operating in the working directory, Mercurial honours the naming |
550 %policy of the filesystem where the working directory is located. If | |
551 %the filesystem is case preserving, but insensitive, Mercurial will | |
552 %treat names that differ only in case as the same. | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
553 |
364 | 554 $B%o!<%-%s%0%G%#%l%/%H%j$G$NF0:n$N:]$K!$(B Mercurial$B$O%o!<%-%s%0%G%#%l%/%H%j(B |
555 $B$N$"$k%U%!%$%k%7%9%F%`$N%M!<%_%s%0%]%j%7!<$rB:=E$9$k!%Bg>.J8;z$rJ]B8$9$k(B | |
556 $B$,6hJL$7$J$$%U%!%$%k%7%9%F%`$N>l9g!$(BMercurial$B$OL>A0$NBg>.$@$1$,0[$J$C$F$$(B | |
557 $B$k%U%!%$%k$rF1$8%U%!%$%k$H$7$F<h$j07$&!%(B | |
558 | |
559 %An important aspect of this approach is that it is possible to commit | |
560 %a changeset on a case sensitive (typically Linux or Unix) filesystem | |
561 %that will cause trouble for users on case insensitive (usually Windows | |
562 %and MacOS) users. If a Linux user commits changes to two files, one | |
563 %named \filename{myfile.c} and the other named \filename{MyFile.C}, | |
564 %they will be stored correctly in the repository. And in the working | |
565 %directories of other Linux users, they will be correctly represented | |
566 %as separate files. | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
567 |
364 | 568 $B$3$N%"%W%m!<%A$G=EMW$J$N$O!$Bg>.$r6hJL$9$k%U%!%$%k%7%9%F%`!JE57?E*$K$O(B |
569 Linux$B$*$h$S(BUnix$B!K$GBg>.$r6hJL$7$J$$%7%9%F%`!JDL>o!$(BWindows$B$^$?$O(BMacOS$B!K$N(B | |
570 $B%f!<%6$K$H$C$F%H%i%V%k$H$J$k$h$&$J%A%'%s%8%;%C%H$r%3%_%C%H$9$k$3$H$,2DG=(B | |
571 $B$G$"$k$H$$$&E@$G$"$k!%$b$7(BLinux$B%f!<%6$,(B\filename{myfile.c}$B$H$$$&%U%!%$%k(B | |
572 $B$H(B\filename{MyFile.C}$B$H$$$&%U%!%$%k$KBP$9$k%A%'%s%8%;%C%H$r%3%_%C%H$7$?>l(B | |
573 $B9g!$$=$l$i$O%j%]%8%H%j$K@5$7$/J]B8$5$l!$B>$N(BLinux$B%f!<%6$N%o!<%-%s%0%G%#%l(B | |
574 $B%/%H%j$G$b@5$7$/JL!9$N%U%!%$%k$H$7$F8=$l$k!%(B | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
575 |
364 | 576 %If a Windows or Mac user pulls this change, they will not initially |
577 %have a problem, because Mercurial's repository storage mechanism is | |
578 %case safe. However, once they try to \hgcmd{update} the working | |
579 %directory to that changeset, or \hgcmd{merge} with that changeset, | |
580 %Mercurial will spot the conflict between the two file names that the | |
581 %filesystem would treat as the same, and forbid the update or merge | |
582 %from occurring. | |
583 | |
584 $B$3$3$G(BWindows$B$^$?$O(BMac$B$N%f!<%6$,$3$N%A%'%s%8%;%C%H$r(Bpull$B$9$k$H!$(B | |
585 Mercurial$B$N%j%]%8%H%j3JG<%a%+%K%:%`$OBg>.J8;z$KBP$7$F0BA4$J$?$a!$:G=i$N$&(B | |
586 $B$A$OLdBj$H$J$i$J$$!%$7$+$7%o!<%-%s%0%G%#%l%/%H%j$r$=$N%A%'%s%8%;%C%H$K(B | |
587 \hgcmd{update}$B$7$h$&$H$7$?$j!$$=$N%A%'%s%8%;%C%H$H(B\hgcmd{merge}$B$7$h$&$H$9(B | |
588 $B$k$H!$(BMercurial$B$O!$(B 2$B$D$N%U%!%$%kL>$r%U%!%$%k%7%9%F%`$,F1$8L>A0$H$7$F07$&(B | |
835
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
589 $B$?$a$K@8$8$k%3%s%U%j%/%H$r8!=P$7!$(B \hgcmd{update}$B$d(B\hgcmd{merge}$B$r5v$5$J(B |
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
590 $B$$!%(B |
364 | 591 |
592 %\subsection{Fixing a case conflict} | |
593 \subsection{$BBgJ8;z>.J8;z$N>WFM$r2r7h$9$k(B} | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
594 |
364 | 595 %If you are using Windows or a Mac in a mixed environment where some of |
596 %your collaborators are using Linux or Unix, and Mercurial reports a | |
597 %case folding conflict when you try to \hgcmd{update} or \hgcmd{merge}, | |
598 %the procedure to fix the problem is simple. | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
599 |
364 | 600 $B$b$7$"$J$?$,(BWindows$B$d(BMac$B$r;H$C$F$$$F!$2??M$+$N6(NO<T$,(BLinux$B$^$?$O(BUnix$B$r;H$C(B |
601 $B$F$$$k:.9g4D6-$G3+H/$r$7$F$*$j!$(B \hgcmd{update}$B$^$?$O(B\hgcmd{merge}$B$G(B | |
602 Mercurial$B$,Bg>.J8;z$N%3%s%U%j%/%H$r8!=P$9$k$N$G$"$l$P!$2r7hJ}K!$O%7%s%W%k(B | |
603 $B$G$"$k!%(B | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
604 |
364 | 605 %Just find a nearby Linux or Unix box, clone the problem repository |
606 %onto it, and use Mercurial's \hgcmd{rename} command to change the | |
607 %names of any offending files or directories so that they will no | |
608 %longer cause case folding conflicts. Commit this change, \hgcmd{pull} | |
609 %or \hgcmd{push} it across to your Windows or MacOS system, and | |
610 %\hgcmd{update} to the revision with the non-conflicting names. | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
611 |
364 | 612 $B<j6a$J(BLinux$B$^$?$O(BUnix$B%^%7%s$N>e$K!$LdBj$N$"$k%j%]%8%H%j$r%/%m!<%s$7!$(B |
613 Mercurial$B$N(B\hgcmd{rename}$B$r<B9T$7$FLdBj$N$"$k%U%!%$%k$d%G%#%l%/%H%j$NL>A0(B | |
614 $B$rJQ99$7!$%3%s%U%j%/%H$r2r7h$9$k!%$3$NJQ99$r%3%_%C%H$7!$(B\hgcmd{pull}$B$^$?(B | |
615 $B$O(B\hgcmd{push}$B%3%^%s%I$G$"$J$?$N(BWindows$B$^$?$O(BMacOS$B%7%9%F%`$KE>Aw(B | |
616 $B$7!$(B\hgcmd{update}$B$G%3%s%U%j%/%H$N$J$$%j%S%8%g%s$X99?7$9$l$P$h$$!%(B | |
617 | |
618 %The changeset with case-conflicting names will remain in your | |
619 %project's history, and you still won't be able to \hgcmd{update} your | |
620 %working directory to that changeset on a Windows or MacOS system, but | |
621 %you can continue development unimpeded. | |
622 | |
623 $BBg>.J8;z$N%U%!%$%kL>%3%s%U%j%/%H$,$"$k%A%'%s%8%;%C%H$O%W%m%8%'%/%H$NMzNr(B | |
835
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
624 $B$K;D$C$F$*$j!$(B Windows$B$d(BMacOS$B%7%9%F%`$G$O$=$N%A%'%s%8%;%C%H$X(B |
364 | 625 \hgcmd{update}$B$9$k$3$H$O$G$-$J$$$b$N$N!$LdBj$J$/3+H/$rB3$1$k$3$H$,$G$-$k!%(B |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
626 |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
627 |
364 | 628 %%% Local Variables: |
293
3b1291f24c0d
- replaved latex-mode to yatex-mode
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
629 %%% mode: yatex |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
630 %%% TeX-master: "00book" |
364 | 631 %%% End: |