# HG changeset patch # User Yoshiki Yazawa # Date 1224483726 -32400 # Node ID 1b372620963a8991582014e5e1615853c9549182 # Parent bc92b28fc970325edf012054071883235f6c7372 finished filenames.tex diff -r bc92b28fc970 -r 1b372620963a ja/filenames.tex --- a/ja/filenames.tex Tue Sep 23 12:27:24 2008 +0900 +++ b/ja/filenames.tex Mon Oct 20 15:22:06 2008 +0900 @@ -1,306 +1,564 @@ -\chapter{File names and pattern matching} +%\chapter{File names and pattern matching} +\chapter{ファイル名とパターンマッチング} \label{chap:names} -Mercurial provides mechanisms that let you work with file names in a -consistent and expressive way. +%Mercurial provides mechanisms that let you work with file names in a +%consistent and expressive way. -\section{Simple file naming} +Mercurialはファイル名について一貫性のあり分かりやすいメカニズムを提供す +る. + +%\section{Simple file naming} +\section{シンプルなファイル命名} -Mercurial uses a unified piece of machinery ``under the hood'' to -handle file names. Every command behaves uniformly with respect to -file names. The way in which commands work with file names is as -follows. +%Mercurial uses a unified piece of machinery ``under the hood'' to +%handle file names. Every command behaves uniformly with respect to +%file names. The way in which commands work with file names is as +%follows. -If you explicitly name real files on the command line, Mercurial works -with exactly those files, as you would expect. +Mercurialはファイル名を取り扱う内部のメカニズムを持っている.あらゆるコマ +ンドはファイル名に対して同一にふるまう.コマンドがファイル名を扱うやり方 +を以下に示す. + +%If you explicitly name real files on the command line, Mercurial works +%with exactly those files, as you would expect. +コマンドラインに実際のファイル名を明示的に与えた時は,Mercurialはそれら +のファイルそのものを扱う. \interaction{filenames.files} -When you provide a directory name, Mercurial will interpret this as -``operate on every file in this directory and its subdirectories''. -Mercurial traverses the files and subdirectories in a directory in -alphabetical order. When it encounters a subdirectory, it will -traverse that subdirectory before continuing with the current -directory. +%When you provide a directory name, Mercurial will interpret this as +%``operate on every file in this directory and its subdirectories''. +%Mercurial traverses the files and subdirectories in a directory in +%alphabetical order. When it encounters a subdirectory, it will +%traverse that subdirectory before continuing with the current +%directory. + +ディレクトリ名を与えた場合は,Mercurialは``このディレクトリとサブディレク +トリ内のすべてのファイルに対して処理を行う''と解釈する. +Mercurialはディレクトリ内のファイルとサブディレクトリをアルファベット順 +に渡り歩く.サブディレクトリを見つけると,カレントディレクトリの処理を続 +けるのではなく,サブディレクトリ内を見に行く. \interaction{filenames.dirs} -\section{Running commands without any file names} +%\section{Running commands without any file names} +\section{ファイル名なしでコマンドを実行する} + +%Mercurial's commands that work with file names have useful default +%behaviours when you invoke them without providing any file names or +%patterns. What kind of behaviour you should expect depends on what +%the command does. Here are a few rules of thumb you can use to +%predict what a command is likely to do if you don't give it any names +%to work with. + +ファイル名を取るMercurialコマンドはファイル名やパターンを与えないで起動し +た場合でも有用なデフォルトの振舞を持つ.期待する挙動は,何をするコマンド +かによる.コマンドにファイル名等を与えなかった場合にコマンドがどのように +動くか推測する大まかなルールをいくつか挙げる. -Mercurial's commands that work with file names have useful default -behaviours when you invoke them without providing any file names or -patterns. What kind of behaviour you should expect depends on what -the command does. Here are a few rules of thumb you can use to -predict what a command is likely to do if you don't give it any names -to work with. \begin{itemize} -\item Most commands will operate on the entire working directory. - This is what the \hgcmd{add} command does, for example. -\item If the command has effects that are difficult or impossible to - reverse, it will force you to explicitly provide at least one name - or pattern (see below). This protects you from accidentally - deleting files by running \hgcmd{remove} with no arguments, for - example. +%\item Most commands will operate on the entire working directory. +% This is what the \hgcmd{add} command does, for example. + \item 大半のコマンドはワーキングディレクトリ全体に対して働く.例えば + \hgcmd{add}コマンドのふるまいがこれにあたる. + +%\item If the command has effects that are difficult or impossible to +% reverse, it will force you to explicitly provide at least one name +% or pattern (see below). This protects you from accidentally +% deleting files by running \hgcmd{remove} with no arguments, for +% example. + \item 復元が難しかったり不可能であるような効果を持つコマンドの場合,最低 + 1つの名前やパターンを陽に要求する.(下記を参照.)これにより,例 + えば\hgcmd{remove}に引数を与えなかったことによって誤ってファイルを + すべて消したりすることがなくなる. \end{itemize} -It's easy to work around these default behaviours if they don't suit -you. If a command normally operates on the whole working directory, -you can invoke it on just the current directory and its subdirectories -by giving it the name ``\dirname{.}''. +%It's easy to work around these default behaviours if they don't suit +%you. If a command normally operates on the whole working directory, +%you can invoke it on just the current directory and its subdirectories +%by giving it the name ``\dirname{.}''. +%\interaction{filenames.wdir-subdir} + +デフォルトの挙動が気に入らない場合,これを変更するのはたやすい. +コマンドが通常ワーキングディレクトリ全体に対して動作するとしよう. +これをカレントディレクトリとそのサブディレクトリに対してのみ動作するよう +に変えるには,``\dirname{.}''を渡せば良い. \interaction{filenames.wdir-subdir} -Along the same lines, some commands normally print file names relative -to the root of the repository, even if you're invoking them from a -subdirectory. Such a command will print file names relative to your -subdirectory if you give it explicit names. Here, we're going to run -\hgcmd{status} from a subdirectory, and get it to operate on the -entire working directory while printing file names relative to our -subdirectory, by passing it the output of the \hgcmd{root} command. -\interaction{filenames.wdir-relname} +%Along the same lines, some commands normally print file names relative +%to the root of the repository, even if you're invoking them from a +%subdirectory. Such a command will print file names relative to your + +%subdirectory if you give it explicit names. Here, we're going to run + +%\hgcmd{status} from a subdirectory, and get it to operate on the +%entire working directory while printing file names relative to our + +%subdirectory, by passing it the output of the \hgcmd{root} command. +%\interaction{filenames.wdir-relname} + +サブディレクトリから起動してもリポジトリのルートへの相対パスでファイル名 +を表示するコマンドもある.そのようなコマンドでは,サブディレクトリの名前 +を明示的に与えると,サブディレクトリからの相対パスを表示するようになる. + +ここではサブディレクトリから\hgcmd{status}を実行する際に, + -\section{Telling you what's going on} +して, +コマンドがワーキングディレクトリ全体のファイル名をサブディレクトリに対して相対的に +表示する様を見てみよう. + + + + +%\section{Telling you what's going on} +\section{何が起きているのか} -The \hgcmd{add} example in the preceding section illustrates something -else that's helpful about Mercurial commands. If a command operates -on a file that you didn't name explicitly on the command line, it will -usually print the name of the file, so that you will not be surprised -what's going on. +%The \hgcmd{add} example in the preceding section illustrates something +%else that's helpful about Mercurial commands. If a command operates +%on a file that you didn't name explicitly on the command line, it will +%usually print the name of the file, so that you will not be surprised +%what's going on. + +前セクションの\hgcmd{add}の例はMercurialコマンドについて別の有用な情報を +示している.コマンドラインで明示的に名前を指定しなかったファイルに対して +コマンド処理を行う場合,ファイル名を表示し,何が起こっているのか分からな +くならないようにしている. -The principle here is of \emph{least surprise}. If you've exactly -named a file on the command line, there's no point in repeating it -back at you. If Mercurial is acting on a file \emph{implicitly}, -because you provided no names, or a directory, or a pattern (see -below), it's safest to tell you what it's doing. +%The principle here is of \emph{least surprise}. If you've exactly +%named a file on the command line, there's no point in repeating it +%back at you. If Mercurial is acting on a file \emph{implicitly}, +%because you provided no names, or a directory, or a pattern (see +%below), it's safest to tell you what it's doing. + +\emph{できるだけびっくりさせない}というのがここでの原則である.コマンドラ +インでファイル名を完全に指定した場合,ファイル名が表示されることはない. +Mercurialは,名前を与えないか,ディレクトリ名,以下で解説するパターンを与 +えたために\emph{暗黙的に}指定されたファイルに対してアクションする場合は, +最も安全なやり方として,現在していることを表示する. -For commands that behave this way, you can silence them using the -\hggopt{-q} option. You can also get them to print the name of every -file, even those you've named explicitly, using the \hggopt{-v} -option. +%For commands that behave this way, you can silence them using the +%\hggopt{-q} option. You can also get them to print the name of every +%file, even those you've named explicitly, using the \hggopt{-v} +%option. -\section{Using patterns to identify files} +このように振舞うコマンドを,\hggopt{-q}オプションを与えることで沈黙させる +こともできる.逆に明示的に指定したファイルへの動作であっても\hggopt{-v}オ +プションを与えることですべてのファイル名を表示させることもできる. + +%\section{Using patterns to identify files} +\section{ファイル名識別にパターンを用いる} -In addition to working with file and directory names, Mercurial lets -you use \emph{patterns} to identify files. Mercurial's pattern -handling is expressive. +%In addition to working with file and directory names, Mercurial lets +%you use \emph{patterns} to identify files. Mercurial's pattern +%handling is expressive. + +ファイルやディレクトリ名を使った動作の他に,Mercurialでは\emph{patterns} +を使ってファイルを識別することもできる.Mercurialのパターン処理は強力で +ある. -On Unix-like systems (Linux, MacOS, etc.), the job of matching file -names to patterns normally falls to the shell. On these systems, you -must explicitly tell Mercurial that a name is a pattern. On Windows, -the shell does not expand patterns, so Mercurial will automatically -identify names that are patterns, and expand them for you. +%On Unix-like systems (Linux, MacOS, etc.), the job of matching file +%names to patterns normally falls to the shell. On these systems, you +%must explicitly tell Mercurial that a name is a pattern. On Windows, +%the shell does not expand patterns, so Mercurial will automatically +%identify names that are patterns, and expand them for you. -To provide a pattern in place of a regular name on the command line, -the mechanism is simple: +Unix系のシステム(Linux, MacOS等)ではファイル名とパターンをマッチさせる仕 +事はシェルに任される.これらのシステムでは,名前がパターンであることを明 +示的にMercurialに示さなければならない. Windowsではシェルはパターンを展開 +しないので,Mercurialは与えられた名前が自動的にパターンであることを認識 +し,展開する. + +%To provide a pattern in place of a regular name on the command line, +%the mechanism is simple: + +コマンドラインで通常の名前の代わりにパターンを渡すためのメカニズムはシン +プルである.: \begin{codesample2} syntax:patternbody \end{codesample2} -That is, a pattern is identified by a short text string that says what -kind of pattern this is, followed by a colon, followed by the actual -pattern. +%That is, a pattern is identified by a short text string that says what +%kind of pattern this is, followed by a colon, followed by the actual +%pattern. + +どのようなパターンなのかを識別するための短いテキストの後ろにコロンを挟ん +で実際のパターンが続く. + +%Mercurial supports two kinds of pattern syntax. The most frequently +%used is called \texttt{glob}; this is the same kind of pattern +%matching used by the Unix shell, and should be familiar to Windows +%command prompt users, too. -Mercurial supports two kinds of pattern syntax. The most frequently -used is called \texttt{glob}; this is the same kind of pattern -matching used by the Unix shell, and should be familiar to Windows -command prompt users, too. +Mercurialは2通りのパターン構文をサポートする.最もよく使われるのは +\texttt{glob};で,Unixシェルがパターンマッチングに使用しているものと同様 +のパターンであり,これはWindowsのコマンドプロンプトユーザにとっても親し +み深いものである. -When Mercurial does automatic pattern matching on Windows, it uses -\texttt{glob} syntax. You can thus omit the ``\texttt{glob:}'' prefix -on Windows, but it's safe to use it, too. +%When Mercurial does automatic pattern matching on Windows, it uses +%\texttt{glob} syntax. You can thus omit the ``\texttt{glob:}'' prefix +%on Windows, but it's safe to use it, too. + +MercurialはWindowsでは自動的にパターンマッチングを行うとき +は,\texttt{glob}構文を用いる.従ってWindowsでは``\texttt{glob:}''プレフィ +クスを省略しても安全である. -The \texttt{re} syntax is more powerful; it lets you specify patterns -using regular expressions, also known as regexps. +%The \texttt{re} syntax is more powerful; it lets you specify patterns +%using regular expressions, also known as regexps. + +\texttt{re}構文はより強力で,正規表現を用いることができる. -By the way, in the examples that follow, notice that I'm careful to -wrap all of my patterns in quote characters, so that they won't get -expanded by the shell before Mercurial sees them. +%By the way, in the examples that follow, notice that I'm careful to +%wrap all of my patterns in quote characters, so that they won't get +%expanded by the shell before Mercurial sees them. + +後で示す例では,Mercurialが見る前にシェルで展開されるのを防ぐためにパター +ンを引用文字でくるんでいることに注意されたい. -\subsection{Shell-style \texttt{glob} patterns} +%\subsection{Shell-style \texttt{glob} patterns} +\subsection{シェル形式の\texttt{glob}パターン} + +%This is an overview of the kinds of patterns you can use when you're +%matching on glob patterns. -This is an overview of the kinds of patterns you can use when you're -matching on glob patterns. +globパターンでマッチングを行う時に使えるパターンの概略を示す. -The ``\texttt{*}'' character matches any string, within a single -directory. +%The ``\texttt{*}'' character matches any string, within a single +%directory. + +``\texttt{*}''文字はディレクトリ内の任意の文字列とマッチする. + \interaction{filenames.glob.star} -The ``\texttt{**}'' pattern matches any string, and crosses directory -boundaries. It's not a standard Unix glob token, but it's accepted by -several popular Unix shells, and is very useful. +%The ``\texttt{**}'' pattern matches any string, and crosses directory +%boundaries. It's not a standard Unix glob token, but it's accepted by +%several popular Unix shells, and is very useful. +%\interaction{filenames.glob.starstar} + +``\texttt{**}''パターンはディレクトリを越えて任意の文字列にマッチする.こ +れはUnix標準のglobトークンではないが,いくつかの人気のあるUnixシェルで使 +うことができ,とても有用である. \interaction{filenames.glob.starstar} -The ``\texttt{?}'' pattern matches any single character. +%The ``\texttt{?}'' pattern matches any single character. +%\interaction{filenames.glob.question} + +``\texttt{?}''パターンは任意の1文字にマッチする. \interaction{filenames.glob.question} -The ``\texttt{[}'' character begins a \emph{character class}. This -matches any single character within the class. The class ends with a -``\texttt{]}'' character. A class may contain multiple \emph{range}s -of the form ``\texttt{a-f}'', which is shorthand for -``\texttt{abcdef}''. +%The ``\texttt{[}'' character begins a \emph{character class}. This +%matches any single character within the class. The class ends with a +%``\texttt{]}'' character. A class may contain multiple \emph{range}s +%of the form ``\texttt{a-f}'', which is shorthand for +%``\texttt{abcdef}''. + +``\texttt{[}''文字は\emph{文字クラス}を開始する.これはクラス内の任意の1 +文字にマッチする.クラスは``\texttt{]}''文字で終る.クラスは +``\texttt{a-f}''のような範囲を複数持つことができる.この範囲は +``\texttt{abcdef}''の短縮形に相当する. \interaction{filenames.glob.range} -If the first character after the ``\texttt{[}'' in a character class -is a ``\texttt{!}'', it \emph{negates} the class, making it match any -single character not in the class. + +%If the first character after the ``\texttt{[}'' in a character class +%is a ``\texttt{!}'', it \emph{negates} the class, making it match any +%single character not in the class. + +文字クラスで``\texttt{[}''の後に``\texttt{!}''が来た場合,これはクラスの +否定となり,クラスに含まれない任意の1文字とマッチする. -A ``\texttt{\{}'' begins a group of subpatterns, where the whole group -matches if any subpattern in the group matches. The ``\texttt{,}'' -character separates subpatterns, and ``\texttt{\}}'' ends the group. +%A ``\texttt{\{}'' begins a group of subpatterns, where the whole group +%matches if any subpattern in the group matches. The ``\texttt{,}'' +%character separates subpatterns, and ``\texttt{\}}'' ends the group. + +``\texttt{\{}''はサブパターンのグループを開始する.グループでは,グループ +内の任意のサブパターンがマッチすればグループ全体がマッチしたことになる. +``\texttt{,}''文字はサブパターンを分離し,``\texttt{\}}''はグループを終了 +する. \interaction{filenames.glob.group} -\subsubsection{Watch out!} +%\subsubsection{Watch out!} +\subsubsection{ここに注意!} -Don't forget that if you want to match a pattern in any directory, you -should not be using the ``\texttt{*}'' match-any token, as this will -only match within one directory. Instead, use the ``\texttt{**}'' -token. This small example illustrates the difference between the two. +%Don't forget that if you want to match a pattern in any directory, you +%should not be using the ``\texttt{*}'' match-any token, as this will +%only match within one directory. Instead, use the ``\texttt{**}'' +%token. This small example illustrates the difference between the two. + +任意のディレクトリでパターンをマッチさせる場合,``\texttt{*}''を全てとマッ +チするトークンとして使うことはできない.この文字は1つのディレクトリ内での +みマッチする.その代わり,``\texttt{**}''トークンを使う.これらの違いを説 +明するために例を示す. + \interaction{filenames.glob.star-starstar} -\subsection{Regular expression matching with \texttt{re} patterns} +%\subsection{Regular expression matching with \texttt{re} patterns} +\subsection{\texttt{re}パターンを使った正規表現マッチ} + +%Mercurial accepts the same regular expression syntax as the Python +%programming language (it uses Python's regexp engine internally). +%This is based on the Perl language's regexp syntax, which is the most +%popular dialect in use (it's also used in Java, for example). -Mercurial accepts the same regular expression syntax as the Python -programming language (it uses Python's regexp engine internally). -This is based on the Perl language's regexp syntax, which is the most -popular dialect in use (it's also used in Java, for example). +MercurialはPython言語と同じ正規表現構文を受け付ける.(Mercurialは内部で +Pythonの正規表現エンジンを使っている.)これはPerlのregexp構文を元にして +いる.この構文は最もよく用いられているものであり,たとえばJavaでも利用さ +れている. + +%I won't discuss Mercurial's regexp dialect in any detail here, as +%regexps are not often used. Perl-style regexps are in any case +%already exhaustively documented on a multitude of web sites, and in +%many books. Instead, I will focus here on a few things you should +%know if you find yourself needing to use regexps with Mercurial. -I won't discuss Mercurial's regexp dialect in any detail here, as -regexps are not often used. Perl-style regexps are in any case -already exhaustively documented on a multitude of web sites, and in -many books. Instead, I will focus here on a few things you should -know if you find yourself needing to use regexps with Mercurial. +regexpがそれほど使われていないかのようにここでMercurialのregexp構文につい +て議論することは避ける. Perlスタイルregexpはすでに多くのウェブサイトや書 +籍でで詳細に渡って説明されている.その代わり,ここではMercurialでregexpを +使う際に知っておくべきいくつかの点に焦点を当てることにする. + +%A regexp is matched against an entire file name, relative to the root +%of the repository. In other words, even if you're already in +%subbdirectory \dirname{foo}, if you want to match files under this +%directory, your pattern must start with ``\texttt{foo/}''. -A regexp is matched against an entire file name, relative to the root -of the repository. In other words, even if you're already in -subbdirectory \dirname{foo}, if you want to match files under this -directory, your pattern must start with ``\texttt{foo/}''. +regexpはファイル名全体とマッチするが,ファイル名はリポジトリのルートから +の相対パスで表される.言い替えれば,すでにサブディレクトリ\dirname{foo}に +いるとして,このディレクトリ内のファイルにマッチさせたけれ +ば,``\texttt{foo/}''で始まるパターンを渡す必要がある. + +%One thing to note, if you're familiar with Perl-style regexps, is that +%Mercurial's are \emph{rooted}. That is, a regexp starts matching +%against the beginning of a string; it doesn't look for a match +%anywhere within the string. To match anywhere in a string, start +%your pattern with ``\texttt{.*}''. -One thing to note, if you're familiar with Perl-style regexps, is that -Mercurial's are \emph{rooted}. That is, a regexp starts matching -against the beginning of a string; it doesn't look for a match -anywhere within the string. To match anywhere in a string, start -your pattern with ``\texttt{.*}''. +Perl形式のregexpに慣れているのなら,Mercurialのregexpは\emph{root}を持つ +という点に注意しておくとよい.すなわち,regexpは文字列の始まりからマッチ +し,文字列の途中からはマッチしない.文字列の途中からマッチさせたい場合 +は,パターンを``\texttt{.*}''で始める必要がある. + +%\section{Filtering files} +\section{ファイルをフィルタする} -\section{Filtering files} +%Not only does Mercurial give you a variety of ways to specify files; +%it lets you further winnow those files using \emph{filters}. Commands +%that work with file names accept two filtering options. -Not only does Mercurial give you a variety of ways to specify files; -it lets you further winnow those files using \emph{filters}. Commands -that work with file names accept two filtering options. +Mercurialはファイルを指定する様々な方法を提供するだけでなく,さらに +\emph{フィルタ}によってファイルを選別する方法を提供する.ファイル名を取っ +て動作するコマンドは2つのフィルタオプションを受け付ける. + \begin{itemize} -\item \hggopt{-I}, or \hggopt{--include}, lets you specify a pattern - that file names must match in order to be processed. -\item \hggopt{-X}, or \hggopt{--exclude}, gives you a way to - \emph{avoid} processing files, if they match this pattern. +%\item \hggopt{-I}, or \hggopt{--include}, lets you specify a pattern +% that file names must match in order to be processed. + \item \hggopt{-I}または\hggopt{--include}オプションで指定したパターンに + マッチしたファイルが処理される. +%\item \hggopt{-X}, or \hggopt{--exclude}, gives you a way to +% \emph{avoid} processing files, if they match this pattern. + \item \hggopt{-X}または\hggopt{--exclude}オプションで指定したパターンに + マッチしたファイルは処理から除外される. \end{itemize} -You can provide multiple \hggopt{-I} and \hggopt{-X} options on the -command line, and intermix them as you please. Mercurial interprets -the patterns you provide using glob syntax by default (but you can use -regexps if you need to). + +%You can provide multiple \hggopt{-I} and \hggopt{-X} options on the +%command line, and intermix them as you please. Mercurial interprets +%the patterns you provide using glob syntax by default (but you can use +%regexps if you need to). + +コマンドラインで複数の\hggopt{-I}および\hggopt{-X}オプションを指定し,所 +望の組合せにすることができる. Mercurialはデフォルトではglob構文で与えた +パターンを解釈するが,正規表現を使うことも可能である. -You can read a \hggopt{-I} filter as ``process only the files that -match this filter''. +%You can read a \hggopt{-I} filter as ``process only the files that +%match this filter''. + +\hggopt{-I}フィルタは``このフィルタにマッチするファイルだけを処理する'' +と読み替えることができる. \interaction{filenames.filter.include} -The \hggopt{-X} filter is best read as ``process only the files that -don't match this pattern''. + +%The \hggopt{-X} filter is best read as ``process only the files that +%don't match this pattern''. + +\hggopt{-X}フィルタは``このパターンにマッチしないファイルだけを処理する''と +読み替えるのが最も相応しい. \interaction{filenames.filter.exclude} -\section{Ignoring unwanted files and directories} +%\section{Ignoring unwanted files and directories} +\section{不要なファイルやディレクトリを無視する} XXX. -\section{Case sensitivity} +%\section{Case sensitivity} +\section{大文字小文字の影響} \label{sec:names:case} -If you're working in a mixed development environment that contains -both Linux (or other Unix) systems and Macs or Windows systems, you -should keep in the back of your mind the knowledge that they treat the -case (``N'' versus ``n'') of file names in incompatible ways. This is -not very likely to affect you, and it's easy to deal with if it does, -but it could surprise you if you don't know about it. +%If you're working in a mixed development environment that contains +%both Linux (or other Unix) systems and Macs or Windows systems, you +%should keep in the back of your mind the knowledge that they treat the +%case (``N'' versus ``n'') of file names in incompatible ways. This is +%not very likely to affect you, and it's easy to deal with if it does, +%but it could surprise you if you don't know about it. -Operating systems and filesystems differ in the way they handle the -\emph{case} of characters in file and directory names. There are -three common ways to handle case in names. +LinuxをはじめとするUnixやMac,Windowsが混在する開発環境で作業をしているの +なら,各々のシステムはファイル名の(``N''と``n'')のような大小文字を異なっ +たやり方で取り扱うことに留意すべきである.これが問題になることは滅多にな +く,問題になる場合でも簡単に解決できるが,システム間での取り扱いの違いを +知らなければ驚くことになるだろう. + +%Operating systems and filesystems differ in the way they handle the +%\emph{case} of characters in file and directory names. There are +%three common ways to handle case in names. +オペレーティングシステムとファイルシステムは,ファイル名とディレクトリ名 +の\emph{大小文字}の扱いで異なっている.大小文字を扱う方法は3通りある. + \begin{itemize} -\item Completely case insensitive. Uppercase and lowercase versions - of a letter are treated as identical, both when creating a file and - during subsequent accesses. This is common on older DOS-based - systems. -\item Case preserving, but insensitive. When a file or directory is - created, the case of its name is stored, and can be retrieved and - displayed by the operating system. When an existing file is being - looked up, its case is ignored. This is the standard arrangement on - Windows and MacOS. The names \filename{foo} and \filename{FoO} - identify the same file. This treatment of uppercase and lowercase - letters as interchangeable is also referred to as \emph{case - folding}. -\item Case sensitive. The case of a name is significant at all times. - The names \filename{foo} and {FoO} identify different files. This - is the way Linux and Unix systems normally work. +%\item Completely case insensitive. Uppercase and lowercase versions +% of a letter are treated as identical, both when creating a file and +% during subsequent accesses. This is common on older DOS-based +% systems. + \item 完全に大小文字を区別しない.大文字と小文字は,ファイルの作成とそ + の後のアクセスで同一に扱われる.これは古いDOSベースのシステムで用 + いられていた. + +%\item Case preserving, but insensitive. When a file or directory is +% created, the case of its name is stored, and can be retrieved and +% displayed by the operating system. When an existing file is being +% looked up, its case is ignored. This is the standard arrangement on +% Windows and MacOS. The names \filename{foo} and \filename{FoO} +% identify the same file. This treatment of uppercase and lowercase +% letters as interchangeable is also referred to as \emph{case +% folding}. + \item 大小文字の違いは保存されるが区別されない.ファイルやディレクトリが + 作られると,オペレーティングシステムは名前の大小文字を保存し,表示 + などに使用する.既存のファイルが参照される時は,大小文字は無視され + る.これはWindowsとMacOSで標準的な取り扱いである.\filename{foo}と + \filename{FoO}は同一のファイルと認識される.このような大小文字の取 + り扱いは\emph{case folding}と呼ばれることもある. + +%\item Case sensitive. The case of a name is significant at all times. +% The names \filename{foo} and {FoO} identify different files. This +% is the way Linux and Unix systems normally work. + \item 大小文字を区別する.常に大小文字で名前を区別する.\filename{foo} + と{FoO}は別のファイルと認識される.これはLinuxやUnixシステムの通 + 常の取り扱いである. + \end{itemize} -On Unix-like systems, it is possible to have any or all of the above -ways of handling case in action at once. For example, if you use a -USB thumb drive formatted with a FAT32 filesystem on a Linux system, -Linux will handle names on that filesystem in a case preserving, but -insensitive, way. +%On Unix-like systems, it is possible to have any or all of the above +%ways of handling case in action at once. For example, if you use a +%USB thumb drive formatted with a FAT32 filesystem on a Linux system, +%Linux will handle names on that filesystem in a case preserving, but +%insensitive, way. +Unix系のシステムでは同時に上記の方法を利用することが可能である.例えば +USBメモリをLinuxでFAT32ファイルシステムとしてフォーマットした場合, +Linuxはそのファイルシステム上のファイル名を大小文字保存だが区別せずに取り +扱う. + -\subsection{Safe, portable repository storage} +%\subsection{Safe, portable repository storage} +\subsection{安全で可搬なリポジトリストレージ} + +%Mercurial's repository storage mechanism is \emph{case safe}. It +%translates file names so that they can be safely stored on both case +%sensitive and case insensitive filesystems. This means that you can +%use normal file copying tools to transfer a Mercurial repository onto, +%for example, a USB thumb drive, and safely move that drive and +%repository back and forth between a Mac, a PC running Windows, and a +%Linux box. -Mercurial's repository storage mechanism is \emph{case safe}. It -translates file names so that they can be safely stored on both case -sensitive and case insensitive filesystems. This means that you can -use normal file copying tools to transfer a Mercurial repository onto, -for example, a USB thumb drive, and safely move that drive and -repository back and forth between a Mac, a PC running Windows, and a -Linux box. +Mercurialのリポジトリ格納メカニズムは\emph{大小文字セーフ}である. +Mercurialは大小文字の区別をするシステムでもしないシステムでも安全に保存で +きるようにファイル名を変換する.このため,通常のファイルコピーツールを使っ +てMercurialリポジトリをUSBメモリに転送し,Mac,Windowsの動くPC,Linuxマシ +ンの間で移動しても安全である. + + +%\subsection{Detecting case conflicts} +\subsection{大文字小文字の衝突を検出する} -\subsection{Detecting case conflicts} +%When operating in the working directory, Mercurial honours the naming +%policy of the filesystem where the working directory is located. If +%the filesystem is case preserving, but insensitive, Mercurial will +%treat names that differ only in case as the same. -When operating in the working directory, Mercurial honours the naming -policy of the filesystem where the working directory is located. If -the filesystem is case preserving, but insensitive, Mercurial will -treat names that differ only in case as the same. +ワーキングディレクトリでの動作の際に, Mercurialはワーキングディレクトリ +のあるファイルシステムのネーミングポリシーを尊重する.大小文字を保存する +が区別しないファイルシステムの場合,Mercurialは名前の大小だけが異なってい +るファイルを同じファイルとして取り扱う. + +%An important aspect of this approach is that it is possible to commit +%a changeset on a case sensitive (typically Linux or Unix) filesystem +%that will cause trouble for users on case insensitive (usually Windows +%and MacOS) users. If a Linux user commits changes to two files, one +%named \filename{myfile.c} and the other named \filename{MyFile.C}, +%they will be stored correctly in the repository. And in the working +%directories of other Linux users, they will be correctly represented +%as separate files. -An important aspect of this approach is that it is possible to commit -a changeset on a case sensitive (typically Linux or Unix) filesystem -that will cause trouble for users on case insensitive (usually Windows -and MacOS) users. If a Linux user commits changes to two files, one -named \filename{myfile.c} and the other named \filename{MyFile.C}, -they will be stored correctly in the repository. And in the working -directories of other Linux users, they will be correctly represented -as separate files. +このアプローチで重要なのは,大小を区別するファイルシステム(典型的には +LinuxおよびUnix)で大小を区別しないシステム(通常,WindowsまたはMacOS)の +ユーザにとってトラブルとなるようなチェンジセットをコミットすることが可能 +であるという点である.もしLinuxユーザが\filename{myfile.c}というファイル +と\filename{MyFile.C}というファイルに対するチェンジセットをコミットした場 +合,それらはリポジトリに正しく保存され,他のLinuxユーザのワーキングディレ +クトリでも正しく別々のファイルとして現れる. -If a Windows or Mac user pulls this change, they will not initially -have a problem, because Mercurial's repository storage mechanism is -case safe. However, once they try to \hgcmd{update} the working -directory to that changeset, or \hgcmd{merge} with that changeset, -Mercurial will spot the conflict between the two file names that the -filesystem would treat as the same, and forbid the update or merge -from occurring. +%If a Windows or Mac user pulls this change, they will not initially +%have a problem, because Mercurial's repository storage mechanism is +%case safe. However, once they try to \hgcmd{update} the working +%directory to that changeset, or \hgcmd{merge} with that changeset, +%Mercurial will spot the conflict between the two file names that the +%filesystem would treat as the same, and forbid the update or merge +%from occurring. + +ここでWindowsまたはMacのユーザがこのチェンジセットをpullすると, +Mercurialのリポジトリ格納メカニズムは大小文字に対して安全なため,最初のう +ちは問題とならない.しかしワーキングディレクトリをそのチェンジセットに +\hgcmd{update}しようとしたり,そのチェンジセットと\hgcmd{merge}しようとす +ると,Mercurialは, 2つのファイル名をファイルシステムが同じ名前として扱う +ために生じるコンフリクトを検出し, updateやmergeを許さない. + +%\subsection{Fixing a case conflict} +\subsection{大文字小文字の衝突を解決する} -\subsection{Fixing a case conflict} +%If you are using Windows or a Mac in a mixed environment where some of +%your collaborators are using Linux or Unix, and Mercurial reports a +%case folding conflict when you try to \hgcmd{update} or \hgcmd{merge}, +%the procedure to fix the problem is simple. -If you are using Windows or a Mac in a mixed environment where some of -your collaborators are using Linux or Unix, and Mercurial reports a -case folding conflict when you try to \hgcmd{update} or \hgcmd{merge}, -the procedure to fix the problem is simple. +もしあなたがWindowsやMacを使っていて,何人かの協力者がLinuxまたはUnixを使っ +ている混合環境で開発をしており, \hgcmd{update}または\hgcmd{merge}で +Mercurialが大小文字のコンフリクトを検出するのであれば,解決方法はシンプル +である. -Just find a nearby Linux or Unix box, clone the problem repository -onto it, and use Mercurial's \hgcmd{rename} command to change the -names of any offending files or directories so that they will no -longer cause case folding conflicts. Commit this change, \hgcmd{pull} -or \hgcmd{push} it across to your Windows or MacOS system, and -\hgcmd{update} to the revision with the non-conflicting names. +%Just find a nearby Linux or Unix box, clone the problem repository +%onto it, and use Mercurial's \hgcmd{rename} command to change the +%names of any offending files or directories so that they will no +%longer cause case folding conflicts. Commit this change, \hgcmd{pull} +%or \hgcmd{push} it across to your Windows or MacOS system, and +%\hgcmd{update} to the revision with the non-conflicting names. -The changeset with case-conflicting names will remain in your -project's history, and you still won't be able to \hgcmd{update} your -working directory to that changeset on a Windows or MacOS system, but -you can continue development unimpeded. +手近なLinuxまたはUnixマシンの上に,問題のあるリポジトリをクローンし, +Mercurialの\hgcmd{rename}を実行して問題のあるファイルやディレクトリの名前 +を変更し,コンフリクトを解決する.この変更をコミットし,\hgcmd{pull}また +は\hgcmd{push}コマンドであなたのWindowsまたはMacOSシステムに転送 +し,\hgcmd{update}でコンフリクトのないリビジョンへ更新すればよい. + +%The changeset with case-conflicting names will remain in your +%project's history, and you still won't be able to \hgcmd{update} your +%working directory to that changeset on a Windows or MacOS system, but +%you can continue development unimpeded. + +大小文字のファイル名コンフリクトがあるチェンジセットはプロジェクトの履歴 +に残っており, WindowsやMacOSしすてむではそのチェンジセットへ +\hgcmd{update}することはできないものの,問題なく開発を続けることができる. \begin{note} - Prior to version~0.9.3, Mercurial did not use a case safe repository - storage mechanism, and did not detect case folding conflicts. If - you are using an older version of Mercurial on Windows or MacOS, I - strongly recommend that you upgrade. +% Prior to version~0.9.3, Mercurial did not use a case safe repository +% storage mechanism, and did not detect case folding conflicts. If +% you are using an older version of Mercurial on Windows or MacOS, I +% strongly recommend that you upgrade. +0.9.3より前のMercurialはcaseセーフのストレージ機構を使っておらず,caseの + 衝突を検出できなかった.WindowsやMacOSで古いバージョンのMercurialを使っ + ているならば,アップデートすることを強く勧める. \end{note} -%%% Local Variables: +%%% Local Variables: %%% mode: yatex %%% TeX-master: "00book" -%%% End: +%%% End: diff -r bc92b28fc970 -r 1b372620963a ja/todo.txt --- a/ja/todo.txt Tue Sep 23 12:27:24 2008 +0900 +++ b/ja/todo.txt Mon Oct 20 15:22:06 2008 +0900 @@ -3,7 +3,7 @@ collab.tex concepts.tex daily.tex -filenames.tex +filenames.tex 100% hg_id.tex noneed hgext.tex 100% hook.tex