Mercurial > hgbook
annotate ja/filenames.tex @ 380:38f034c1da53
finished daily.tex
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Thu, 19 Feb 2009 14:37:50 +0900 |
parents | 1b372620963a |
children | 5276f40fca1c |
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. | |
25 $B%3%^%s%I%i%$%s$K<B:]$N%U%!%$%kL>$rL@<(E*$KM?$($?;~$O!$(BMercurial$B$O$=$l$i(B | |
26 $B$N%U%!%$%k$=$N$b$N$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. | |
69 \item $BI|85$,Fq$7$+$C$?$jIT2DG=$G$"$k$h$&$J8z2L$r;}$D%3%^%s%I$N>l9g!$:GDc(B | |
70 1$B$D$NL>A0$d%Q%?!<%s$rM[$KMW5a$9$k!%!J2<5-$r;2>H!%!K$3$l$K$h$j!$Nc(B | |
71 $B$($P(B\hgcmd{remove}$B$K0z?t$rM?$($J$+$C$?$3$H$K$h$C$F8m$C$F%U%!%$%k$r(B | |
72 $B$9$Y$F>C$7$?$j$9$k$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 | |
91 %subdirectory if you give it explicit names. Here, we're going to run | |
92 | |
93 %\hgcmd{status} from a subdirectory, and get it to operate on the | |
94 %entire working directory while printing file names relative to our | |
95 | |
96 %subdirectory, by passing it the output of the \hgcmd{root} command. | |
97 %\interaction{filenames.wdir-relname} | |
98 | |
99 $B%5%V%G%#%l%/%H%j$+$i5/F0$7$F$b%j%]%8%H%j$N%k!<%H$X$NAjBP%Q%9$G%U%!%$%kL>(B | |
100 $B$rI=<($9$k%3%^%s%I$b$"$k!%$=$N$h$&$J%3%^%s%I$G$O!$%5%V%G%#%l%/%H%j$NL>A0(B | |
101 $B$rL@<(E*$KM?$($k$H!$%5%V%G%#%l%/%H%j$+$i$NAjBP%Q%9$rI=<($9$k$h$&$K$J$k!%(B | |
102 | |
103 $B$3$3$G$O%5%V%G%#%l%/%H%j$+$i(B\hgcmd{status}$B$r<B9T$9$k:]$K!$(B | |
104 | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
105 |
364 | 106 $B$7$F!$(B |
107 $B%3%^%s%I$,%o!<%-%s%0%G%#%l%/%H%jA4BN$N%U%!%$%kL>$r%5%V%G%#%l%/%H%j$KBP$7$FAjBPE*$K(B | |
108 $BI=<($9$kMM$r8+$F$_$h$&!%(B | |
109 | |
110 | |
111 | |
112 | |
113 %\section{Telling you what's going on} | |
114 \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
|
115 |
364 | 116 %The \hgcmd{add} example in the preceding section illustrates something |
117 %else that's helpful about Mercurial commands. If a command operates | |
118 %on a file that you didn't name explicitly on the command line, it will | |
119 %usually print the name of the file, so that you will not be surprised | |
120 %what's going on. | |
121 | |
122 $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 | |
123 $B<($7$F$$$k!%%3%^%s%I%i%$%s$GL@<(E*$KL>A0$r;XDj$7$J$+$C$?%U%!%$%k$KBP$7$F(B | |
124 $B%3%^%s%I=hM}$r9T$&>l9g!$%U%!%$%kL>$rI=<($7!$2?$,5/$3$C$F$$$k$N$+J,$+$i$J(B | |
125 $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
|
126 |
364 | 127 %The principle here is of \emph{least surprise}. If you've exactly |
128 %named a file on the command line, there's no point in repeating it | |
129 %back at you. If Mercurial is acting on a file \emph{implicitly}, | |
130 %because you provided no names, or a directory, or a pattern (see | |
131 %below), it's safest to tell you what it's doing. | |
132 | |
133 \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 | |
134 $B%$%s$G%U%!%$%kL>$r40A4$K;XDj$7$?>l9g!$%U%!%$%kL>$,I=<($5$l$k$3$H$O$J$$!%(B | |
135 Mercurial$B$O!$L>A0$rM?$($J$$$+!$%G%#%l%/%H%jL>!$0J2<$G2r@b$9$k%Q%?!<%s$rM?(B | |
136 $B$($?$?$a$K(B\emph{$B0EL[E*$K(B}$B;XDj$5$l$?%U%!%$%k$KBP$7$F%"%/%7%g%s$9$k>l9g$O!$(B | |
137 $B:G$b0BA4$J$d$jJ}$H$7$F!$8=:_$7$F$$$k$3$H$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
|
138 |
364 | 139 %For commands that behave this way, you can silence them using the |
140 %\hggopt{-q} option. You can also get them to print the name of every | |
141 %file, even those you've named explicitly, using the \hggopt{-v} | |
142 %option. | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
143 |
364 | 144 $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 |
145 $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 | |
146 $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 | |
147 | |
148 %\section{Using patterns to identify files} | |
149 \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
|
150 |
364 | 151 %In addition to working with file and directory names, Mercurial lets |
152 %you use \emph{patterns} to identify files. Mercurial's pattern | |
153 %handling is expressive. | |
154 | |
155 $B%U%!%$%k$d%G%#%l%/%H%jL>$r;H$C$?F0:n$NB>$K!$(BMercurial$B$G$O(B\emph{patterns} | |
156 $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 | |
157 $B$"$k!%(B | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
158 |
364 | 159 %On Unix-like systems (Linux, MacOS, etc.), the job of matching file |
160 %names to patterns normally falls to the shell. On these systems, you | |
161 %must explicitly tell Mercurial that a name is a pattern. On Windows, | |
162 %the shell does not expand patterns, so Mercurial will automatically | |
163 %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
|
164 |
364 | 165 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 |
166 $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 | |
167 $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 | |
168 $B$7$J$$$N$G!$(BMercurial$B$OM?$($i$l$?L>A0$,<+F0E*$K%Q%?!<%s$G$"$k$3$H$rG'<1(B | |
169 $B$7!$E83+$9$k!%(B | |
170 | |
171 %To provide a pattern in place of a regular name on the command line, | |
172 %the mechanism is simple: | |
173 | |
174 $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 | |
175 $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
|
176 \begin{codesample2} |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
177 syntax:patternbody |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
178 \end{codesample2} |
364 | 179 %That is, a pattern is identified by a short text string that says what |
180 %kind of pattern this is, followed by a colon, followed by the actual | |
181 %pattern. | |
182 | |
183 $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 | |
184 $B$G<B:]$N%Q%?!<%s$,B3$/!%(B | |
185 | |
186 %Mercurial supports two kinds of pattern syntax. The most frequently | |
187 %used is called \texttt{glob}; this is the same kind of pattern | |
188 %matching used by the Unix shell, and should be familiar to Windows | |
189 %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
|
190 |
364 | 191 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 |
192 \texttt{glob};$B$G!$(BUnix$B%7%'%k$,%Q%?!<%s%^%C%A%s%0$K;HMQ$7$F$$$k$b$N$HF1MM(B | |
193 $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 | |
194 $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
|
195 |
364 | 196 %When Mercurial does automatic pattern matching on Windows, it uses |
197 %\texttt{glob} syntax. You can thus omit the ``\texttt{glob:}'' prefix | |
198 %on Windows, but it's safe to use it, too. | |
199 | |
200 Mercurial$B$O(BWindows$B$G$O<+F0E*$K%Q%?!<%s%^%C%A%s%0$r9T$&$H$-(B | |
201 $B$O!$(B\texttt{glob}$B9=J8$rMQ$$$k!%=>$C$F(BWindows$B$G$O(B``\texttt{glob:}''$B%W%l%U%#(B | |
202 $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
|
203 |
364 | 204 %The \texttt{re} syntax is more powerful; it lets you specify patterns |
205 %using regular expressions, also known as regexps. | |
206 | |
207 \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
|
208 |
364 | 209 %By the way, in the examples that follow, notice that I'm careful to |
210 %wrap all of my patterns in quote characters, so that they won't get | |
211 %expanded by the shell before Mercurial sees them. | |
212 | |
213 $B8e$G<($9Nc$G$O!$(BMercurial$B$,8+$kA0$K%7%'%k$GE83+$5$l$k$N$rKI$0$?$a$K%Q%?!<(B | |
214 $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
|
215 |
364 | 216 %\subsection{Shell-style \texttt{glob} patterns} |
217 \subsection{$B%7%'%k7A<0$N(B\texttt{glob}$B%Q%?!<%s(B} | |
218 | |
219 %This is an overview of the kinds of patterns you can use when you're | |
220 %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
|
221 |
364 | 222 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
|
223 |
364 | 224 %The ``\texttt{*}'' character matches any string, within a single |
225 %directory. | |
226 | |
227 ``\texttt{*}''$BJ8;z$O%G%#%l%/%H%jFb$NG$0U$NJ8;zNs$H%^%C%A$9$k!%(B | |
228 | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
229 \interaction{filenames.glob.star} |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
230 |
364 | 231 %The ``\texttt{**}'' pattern matches any string, and crosses directory |
232 %boundaries. It's not a standard Unix glob token, but it's accepted by | |
233 %several popular Unix shells, and is very useful. | |
234 %\interaction{filenames.glob.starstar} | |
235 | |
236 ``\texttt{**}''$B%Q%?!<%s$O%G%#%l%/%H%j$r1[$($FG$0U$NJ8;zNs$K%^%C%A$9$k!%$3(B | |
237 $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 | |
238 $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
|
239 \interaction{filenames.glob.starstar} |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
240 |
364 | 241 %The ``\texttt{?}'' pattern matches any single character. |
242 %\interaction{filenames.glob.question} | |
243 | |
244 ``\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
|
245 \interaction{filenames.glob.question} |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
246 |
364 | 247 %The ``\texttt{[}'' character begins a \emph{character class}. This |
248 %matches any single character within the class. The class ends with a | |
249 %``\texttt{]}'' character. A class may contain multiple \emph{range}s | |
250 %of the form ``\texttt{a-f}'', which is shorthand for | |
251 %``\texttt{abcdef}''. | |
252 | |
253 ``\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 | |
254 $BJ8;z$K%^%C%A$9$k!%%/%i%9$O(B``\texttt{]}''$BJ8;z$G=*$k!%%/%i%9$O(B | |
255 ``\texttt{a-f}''$B$N$h$&$JHO0O$rJ#?t;}$D$3$H$,$G$-$k!%$3$NHO0O$O(B | |
256 ``\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
|
257 \interaction{filenames.glob.range} |
364 | 258 |
259 %If the first character after the ``\texttt{[}'' in a character class | |
260 %is a ``\texttt{!}'', it \emph{negates} the class, making it match any | |
261 %single character not in the class. | |
262 | |
263 $BJ8;z%/%i%9$G(B``\texttt{[}''$B$N8e$K(B``\texttt{!}''$B$,Mh$?>l9g!$$3$l$O%/%i%9$N(B | |
264 $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
|
265 |
364 | 266 %A ``\texttt{\{}'' begins a group of subpatterns, where the whole group |
267 %matches if any subpattern in the group matches. The ``\texttt{,}'' | |
268 %character separates subpatterns, and ``\texttt{\}}'' ends the group. | |
269 | |
270 ``\texttt{\{}''$B$O%5%V%Q%?!<%s$N%0%k!<%W$r3+;O$9$k!%%0%k!<%W$G$O!$%0%k!<%W(B | |
271 $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 | |
272 ``\texttt{,}''$BJ8;z$O%5%V%Q%?!<%s$rJ,N%$7!$(B``\texttt{\}}''$B$O%0%k!<%W$r=*N;(B | |
273 $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
|
274 \interaction{filenames.glob.group} |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
275 |
364 | 276 %\subsubsection{Watch out!} |
277 \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
|
278 |
364 | 279 %Don't forget that if you want to match a pattern in any directory, you |
280 %should not be using the ``\texttt{*}'' match-any token, as this will | |
281 %only match within one directory. Instead, use the ``\texttt{**}'' | |
282 %token. This small example illustrates the difference between the two. | |
283 | |
284 $BG$0U$N%G%#%l%/%H%j$G%Q%?!<%s$r%^%C%A$5$;$k>l9g!$(B``\texttt{*}''$B$rA4$F$H%^%C(B | |
285 $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 | |
286 $B$_%^%C%A$9$k!%$=$NBe$o$j!$(B``\texttt{**}''$B%H!<%/%s$r;H$&!%$3$l$i$N0c$$$r@b(B | |
287 $BL@$9$k$?$a$KNc$r<($9!%(B | |
288 | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
289 \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
|
290 |
364 | 291 %\subsection{Regular expression matching with \texttt{re} patterns} |
292 \subsection{\texttt{re}$B%Q%?!<%s$r;H$C$?@55,I=8=%^%C%A(B} | |
293 | |
294 %Mercurial accepts the same regular expression syntax as the Python | |
295 %programming language (it uses Python's regexp engine internally). | |
296 %This is based on the Perl language's regexp syntax, which is the most | |
297 %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
|
298 |
364 | 299 Mercurial$B$O(BPython$B8@8l$HF1$8@55,I=8=9=J8$r<u$1IU$1$k!%!J(BMercurial$B$OFbIt$G(B |
300 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 | |
301 $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 | |
302 $B$l$F$$$k!%(B | |
303 | |
304 %I won't discuss Mercurial's regexp dialect in any detail here, as | |
305 %regexps are not often used. Perl-style regexps are in any case | |
306 %already exhaustively documented on a multitude of web sites, and in | |
307 %many books. Instead, I will focus here on a few things you should | |
308 %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
|
309 |
364 | 310 regexp$B$,$=$l$[$I;H$o$l$F$$$J$$$+$N$h$&$K$3$3$G(BMercurial$B$N(Bregexp$B9=J8$K$D$$(B |
311 $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 | |
312 $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 | |
313 $B;H$&:]$KCN$C$F$*$/$Y$-$$$/$D$+$NE@$K>GE@$rEv$F$k$3$H$K$9$k!%(B | |
314 | |
315 %A regexp is matched against an entire file name, relative to the root | |
316 %of the repository. In other words, even if you're already in | |
317 %subbdirectory \dirname{foo}, if you want to match files under this | |
318 %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
|
319 |
364 | 320 regexp$B$O%U%!%$%kL>A4BN$H%^%C%A$9$k$,!$%U%!%$%kL>$O%j%]%8%H%j$N%k!<%H$+$i(B |
321 $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 | |
322 $B$$$k$H$7$F!$$3$N%G%#%l%/%H%jFb$N%U%!%$%k$K%^%C%A$5$;$?$1$l(B | |
323 $B$P!$(B``\texttt{foo/}''$B$G;O$^$k%Q%?!<%s$rEO$9I,MW$,$"$k!%(B | |
324 | |
325 %One thing to note, if you're familiar with Perl-style regexps, is that | |
326 %Mercurial's are \emph{rooted}. That is, a regexp starts matching | |
327 %against the beginning of a string; it doesn't look for a match | |
328 %anywhere within the string. To match anywhere in a string, start | |
329 %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
|
330 |
364 | 331 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 |
332 $B$H$$$&E@$KCm0U$7$F$*$/$H$h$$!%$9$J$o$A!$(Bregexp$B$OJ8;zNs$N;O$^$j$+$i%^%C%A(B | |
333 $B$7!$J8;zNs$NESCf$+$i$O%^%C%A$7$J$$!%J8;zNs$NESCf$+$i%^%C%A$5$;$?$$>l9g(B | |
334 $B$O!$%Q%?!<%s$r(B``\texttt{.*}''$B$G;O$a$kI,MW$,$"$k!%(B | |
335 | |
336 %\section{Filtering files} | |
337 \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
|
338 |
364 | 339 %Not only does Mercurial give you a variety of ways to specify files; |
340 %it lets you further winnow those files using \emph{filters}. Commands | |
341 %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
|
342 |
364 | 343 Mercurial$B$O%U%!%$%k$r;XDj$9$kMM!9$JJ}K!$rDs6!$9$k$@$1$G$J$/!$$5$i$K(B |
344 \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 | |
345 $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 | |
346 | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
347 \begin{itemize} |
364 | 348 %\item \hggopt{-I}, or \hggopt{--include}, lets you specify a pattern |
349 % that file names must match in order to be processed. | |
350 \item \hggopt{-I}$B$^$?$O(B\hggopt{--include}$B%*%W%7%g%s$G;XDj$7$?%Q%?!<%s$K(B | |
351 $B%^%C%A$7$?%U%!%$%k$,=hM}$5$l$k!%(B | |
352 %\item \hggopt{-X}, or \hggopt{--exclude}, gives you a way to | |
353 % \emph{avoid} processing files, if they match this pattern. | |
354 \item \hggopt{-X}$B$^$?$O(B\hggopt{--exclude}$B%*%W%7%g%s$G;XDj$7$?%Q%?!<%s$K(B | |
355 $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
|
356 \end{itemize} |
364 | 357 |
358 %You can provide multiple \hggopt{-I} and \hggopt{-X} options on the | |
359 %command line, and intermix them as you please. Mercurial interprets | |
360 %the patterns you provide using glob syntax by default (but you can use | |
361 %regexps if you need to). | |
362 | |
363 $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 | |
364 $BK>$NAH9g$;$K$9$k$3$H$,$G$-$k!%(B Mercurial$B$O%G%U%)%k%H$G$O(Bglob$B9=J8$GM?$($?(B | |
365 $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
|
366 |
364 | 367 %You can read a \hggopt{-I} filter as ``process only the files that |
368 %match this filter''. | |
369 | |
370 \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'' | |
371 $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
|
372 \interaction{filenames.filter.include} |
364 | 373 |
374 %The \hggopt{-X} filter is best read as ``process only the files that | |
375 %don't match this pattern''. | |
376 | |
377 \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 | |
378 $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
|
379 \interaction{filenames.filter.exclude} |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
380 |
364 | 381 %\section{Ignoring unwanted files and directories} |
382 \section{$BITMW$J%U%!%$%k$d%G%#%l%/%H%j$rL5;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
|
383 |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
384 XXX. |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
385 |
364 | 386 %\section{Case sensitivity} |
387 \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
|
388 \label{sec:names:case} |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
389 |
364 | 390 %If you're working in a mixed development environment that contains |
391 %both Linux (or other Unix) systems and Macs or Windows systems, you | |
392 %should keep in the back of your mind the knowledge that they treat the | |
393 %case (``N'' versus ``n'') of file names in incompatible ways. This is | |
394 %not very likely to affect you, and it's easy to deal with if it does, | |
395 %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
|
396 |
364 | 397 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 |
398 $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 | |
399 $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 | |
400 $B$/!$LdBj$K$J$k>l9g$G$b4JC1$K2r7h$G$-$k$,!$%7%9%F%`4V$G$N<h$j07$$$N0c$$$r(B | |
401 $BCN$i$J$1$l$P6C$/$3$H$K$J$k$@$m$&!%(B | |
402 | |
403 %Operating systems and filesystems differ in the way they handle the | |
404 %\emph{case} of characters in file and directory names. There are | |
405 %three common ways to handle case in names. | |
406 $B%*%Z%l!<%F%#%s%0%7%9%F%`$H%U%!%$%k%7%9%F%`$O!$%U%!%$%kL>$H%G%#%l%/%H%jL>(B | |
407 $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 | |
408 | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
409 \begin{itemize} |
364 | 410 %\item Completely case insensitive. Uppercase and lowercase versions |
411 % of a letter are treated as identical, both when creating a file and | |
412 % during subsequent accesses. This is common on older DOS-based | |
413 % systems. | |
414 \item $B40A4$KBg>.J8;z$r6hJL$7$J$$!%BgJ8;z$H>.J8;z$O!$%U%!%$%k$N:n@.$H$=(B | |
415 $B$N8e$N%"%/%;%9$GF10l$K07$o$l$k!%$3$l$O8E$$(BDOS$B%Y!<%9$N%7%9%F%`$GMQ(B | |
416 $B$$$i$l$F$$$?!%(B | |
417 | |
418 %\item Case preserving, but insensitive. When a file or directory is | |
419 % created, the case of its name is stored, and can be retrieved and | |
420 % displayed by the operating system. When an existing file is being | |
421 % looked up, its case is ignored. This is the standard arrangement on | |
422 % Windows and MacOS. The names \filename{foo} and \filename{FoO} | |
423 % identify the same file. This treatment of uppercase and lowercase | |
424 % letters as interchangeable is also referred to as \emph{case | |
425 % folding}. | |
426 \item $BBg>.J8;z$N0c$$$OJ]B8$5$l$k$,6hJL$5$l$J$$!%%U%!%$%k$d%G%#%l%/%H%j$,(B | |
427 $B:n$i$l$k$H!$%*%Z%l!<%F%#%s%0%7%9%F%`$OL>A0$NBg>.J8;z$rJ]B8$7!$I=<((B | |
428 $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 | |
429 $B$k!%$3$l$O(BWindows$B$H(BMacOS$B$GI8=`E*$J<h$j07$$$G$"$k!%(B\filename{foo}$B$H(B | |
430 \filename{FoO}$B$OF10l$N%U%!%$%k$HG'<1$5$l$k!%$3$N$h$&$JBg>.J8;z$N<h(B | |
431 $B$j07$$$O(B\emph{case folding}$B$H8F$P$l$k$3$H$b$"$k!%(B | |
432 | |
433 %\item Case sensitive. The case of a name is significant at all times. | |
434 % The names \filename{foo} and {FoO} identify different files. This | |
435 % is the way Linux and Unix systems normally work. | |
436 \item $BBg>.J8;z$r6hJL$9$k!%>o$KBg>.J8;z$GL>A0$r6hJL$9$k!%(B\filename{foo} | |
437 $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 | |
438 $B>o$N<h$j07$$$G$"$k!%(B | |
439 | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
440 \end{itemize} |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
441 |
364 | 442 %On Unix-like systems, it is possible to have any or all of the above |
443 %ways of handling case in action at once. For example, if you use a | |
444 %USB thumb drive formatted with a FAT32 filesystem on a Linux system, | |
445 %Linux will handle names on that filesystem in a case preserving, but | |
446 %insensitive, way. | |
447 Unix$B7O$N%7%9%F%`$G$OF1;~$K>e5-$NJ}K!$rMxMQ$9$k$3$H$,2DG=$G$"$k!%Nc$($P(B | |
448 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 | |
449 Linux$B$O$=$N%U%!%$%k%7%9%F%`>e$N%U%!%$%kL>$rBg>.J8;zJ]B8$@$,6hJL$;$:$K<h$j(B | |
450 $B07$&!%(B | |
451 | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
452 |
364 | 453 %\subsection{Safe, portable repository storage} |
454 \subsection{$B0BA4$G2DHB$J%j%]%8%H%j%9%H%l!<%8(B} | |
455 | |
456 %Mercurial's repository storage mechanism is \emph{case safe}. It | |
457 %translates file names so that they can be safely stored on both case | |
458 %sensitive and case insensitive filesystems. This means that you can | |
459 %use normal file copying tools to transfer a Mercurial repository onto, | |
460 %for example, a USB thumb drive, and safely move that drive and | |
461 %repository back and forth between a Mac, a PC running Windows, and a | |
462 %Linux box. | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
463 |
364 | 464 Mercurial$B$N%j%]%8%H%j3JG<%a%+%K%:%`$O(B\emph{$BBg>.J8;z%;!<%U(B}$B$G$"$k!%(B |
465 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 | |
466 $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 | |
467 $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 | |
468 $B%s$N4V$G0\F0$7$F$b0BA4$G$"$k!%(B | |
469 | |
470 | |
471 %\subsection{Detecting case conflicts} | |
472 \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
|
473 |
364 | 474 %When operating in the working directory, Mercurial honours the naming |
475 %policy of the filesystem where the working directory is located. If | |
476 %the filesystem is case preserving, but insensitive, Mercurial will | |
477 %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
|
478 |
364 | 479 $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 |
480 $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 | |
481 $B$,6hJL$7$J$$%U%!%$%k%7%9%F%`$N>l9g!$(BMercurial$B$OL>A0$NBg>.$@$1$,0[$J$C$F$$(B | |
482 $B$k%U%!%$%k$rF1$8%U%!%$%k$H$7$F<h$j07$&!%(B | |
483 | |
484 %An important aspect of this approach is that it is possible to commit | |
485 %a changeset on a case sensitive (typically Linux or Unix) filesystem | |
486 %that will cause trouble for users on case insensitive (usually Windows | |
487 %and MacOS) users. If a Linux user commits changes to two files, one | |
488 %named \filename{myfile.c} and the other named \filename{MyFile.C}, | |
489 %they will be stored correctly in the repository. And in the working | |
490 %directories of other Linux users, they will be correctly represented | |
491 %as separate files. | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
492 |
364 | 493 $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 |
494 Linux$B$*$h$S(BUnix$B!K$GBg>.$r6hJL$7$J$$%7%9%F%`!JDL>o!$(BWindows$B$^$?$O(BMacOS$B!K$N(B | |
495 $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 | |
496 $B$G$"$k$H$$$&E@$G$"$k!%$b$7(BLinux$B%f!<%6$,(B\filename{myfile.c}$B$H$$$&%U%!%$%k(B | |
497 $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 | |
498 $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 | |
499 $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
|
500 |
364 | 501 %If a Windows or Mac user pulls this change, they will not initially |
502 %have a problem, because Mercurial's repository storage mechanism is | |
503 %case safe. However, once they try to \hgcmd{update} the working | |
504 %directory to that changeset, or \hgcmd{merge} with that changeset, | |
505 %Mercurial will spot the conflict between the two file names that the | |
506 %filesystem would treat as the same, and forbid the update or merge | |
507 %from occurring. | |
508 | |
509 $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 | |
510 Mercurial$B$N%j%]%8%H%j3JG<%a%+%K%:%`$OBg>.J8;z$KBP$7$F0BA4$J$?$a!$:G=i$N$&(B | |
511 $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 | |
512 \hgcmd{update}$B$7$h$&$H$7$?$j!$$=$N%A%'%s%8%;%C%H$H(B\hgcmd{merge}$B$7$h$&$H$9(B | |
513 $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 | |
514 $B$?$a$K@8$8$k%3%s%U%j%/%H$r8!=P$7!$(B update$B$d(Bmerge$B$r5v$5$J$$!%(B | |
515 | |
516 %\subsection{Fixing a case conflict} | |
517 \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
|
518 |
364 | 519 %If you are using Windows or a Mac in a mixed environment where some of |
520 %your collaborators are using Linux or Unix, and Mercurial reports a | |
521 %case folding conflict when you try to \hgcmd{update} or \hgcmd{merge}, | |
522 %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
|
523 |
364 | 524 $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 |
525 $B$F$$$k:.9g4D6-$G3+H/$r$7$F$*$j!$(B \hgcmd{update}$B$^$?$O(B\hgcmd{merge}$B$G(B | |
526 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 | |
527 $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
|
528 |
364 | 529 %Just find a nearby Linux or Unix box, clone the problem repository |
530 %onto it, and use Mercurial's \hgcmd{rename} command to change the | |
531 %names of any offending files or directories so that they will no | |
532 %longer cause case folding conflicts. Commit this change, \hgcmd{pull} | |
533 %or \hgcmd{push} it across to your Windows or MacOS system, and | |
534 %\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
|
535 |
364 | 536 $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 |
537 Mercurial$B$N(B\hgcmd{rename}$B$r<B9T$7$FLdBj$N$"$k%U%!%$%k$d%G%#%l%/%H%j$NL>A0(B | |
538 $B$rJQ99$7!$%3%s%U%j%/%H$r2r7h$9$k!%$3$NJQ99$r%3%_%C%H$7!$(B\hgcmd{pull}$B$^$?(B | |
539 $B$O(B\hgcmd{push}$B%3%^%s%I$G$"$J$?$N(BWindows$B$^$?$O(BMacOS$B%7%9%F%`$KE>Aw(B | |
540 $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 | |
541 | |
542 %The changeset with case-conflicting names will remain in your | |
543 %project's history, and you still won't be able to \hgcmd{update} your | |
544 %working directory to that changeset on a Windows or MacOS system, but | |
545 %you can continue development unimpeded. | |
546 | |
547 $BBg>.J8;z$N%U%!%$%kL>%3%s%U%j%/%H$,$"$k%A%'%s%8%;%C%H$O%W%m%8%'%/%H$NMzNr(B | |
548 $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 | |
549 \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
|
550 |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
551 \begin{note} |
364 | 552 % Prior to version~0.9.3, Mercurial did not use a case safe repository |
553 % storage mechanism, and did not detect case folding conflicts. If | |
554 % you are using an older version of Mercurial on Windows or MacOS, I | |
555 % strongly recommend that you upgrade. | |
556 0.9.3$B$h$jA0$N(BMercurial$B$O(Bcase$B%;!<%U$N%9%H%l!<%85!9=$r;H$C$F$*$i$:!$(Bcase$B$N(B | |
557 $B>WFM$r8!=P$G$-$J$+$C$?!%(BWindows$B$d(BMacOS$B$G8E$$%P!<%8%g%s$N(BMercurial$B$r;H$C(B | |
558 $B$F$$$k$J$i$P!$%"%C%W%G!<%H$9$k$3$H$r6/$/4+$a$k!%(B | |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
559 \end{note} |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
560 |
364 | 561 %%% Local Variables: |
293
3b1291f24c0d
- replaved latex-mode to yatex-mode
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
562 %%% mode: yatex |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
563 %%% TeX-master: "00book" |
364 | 564 %%% End: |