hgbook
diff en/daily.tex @ 78:a893de25bc24
Add -v option to run-example, to assist with debugging example scripts.
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Mon Sep 04 14:20:05 2006 -0700 (2006-09-04) |
parents | cbfa08bcf181 |
children | 6b0f4498569e |
line diff
1.1 --- a/en/daily.tex Sun Jul 23 09:46:26 2006 -0700 1.2 +++ b/en/daily.tex Mon Sep 04 14:20:05 2006 -0700 1.3 @@ -50,12 +50,12 @@ 1.4 ``hidden'' file to that directory. On Unix-like systems, any file 1.5 name that begins with a period (``\texttt{.}'') is treated as hidden 1.6 by most commands and GUI tools. This approach is illustrated in 1.7 -figure~\ref{ex:daily:empty}. 1.8 +figure~\ref{ex:daily:hidden}. 1.9 1.10 \begin{figure}[ht] 1.11 - \interaction{daily.files.empty} 1.12 - \caption{Simulating an empty directory} 1.13 - \label{ex:daily:empty} 1.14 + \interaction{daily.files.hidden} 1.15 + \caption{Simulating an empty directory using a hidden file} 1.16 + \label{ex:daily:hidden} 1.17 \end{figure} 1.18 1.19 Another way to tackle a need for an empty directory is to simply 1.20 @@ -65,7 +65,8 @@ 1.21 1.22 If you decide that a file no longer belongs in your repository, use 1.23 the \hgcmd{remove} command; this deletes the file, and tells Mercurial 1.24 -to stop tracking it. 1.25 +to stop tracking it. A removed file is represented in the output of 1.26 +\hgcmd{status} with a ``\texttt{R}''. 1.27 1.28 You might wonder why Mercurial requires you to explicitly tell it that 1.29 you are deleting a file. Earlier during the development of Mercurial, 1.30 @@ -74,13 +75,53 @@ 1.31 tracking the file. In practice, this made it too easy to accidentally 1.32 stop Mercurial from tracking a file. 1.33 1.34 -If you forget to run \hgcmd{remove} to delete a file, you can run 1.35 -\hgcmdopts{remove}{--after} later on, to tell Mercurial that you 1.36 -deleted the file. 1.37 +Mercurial considers a file that you have deleted, but not used 1.38 +\hgcmd{remove} to delete, to be \emph{missing}. A missing file is 1.39 +represented with ``\texttt{!}'' in the output of \hgcmd{status}. 1.40 +Other Mercurial commands will not do anything with missing files. 1.41 + 1.42 +If you have a missing file in your repository, you can run 1.43 +\hgcmdargs{remove}{\hgopt{remove}{--after}} later on, to tell 1.44 +Mercurial that you deleted the file. If you deleted the file by 1.45 +accident, use \hgcmdargs{revert}{\emph{filename}} to restore the file 1.46 +to its last committed state. 1.47 1.48 \subsection{Useful shorthand---adding and removing files in one step} 1.49 1.50 +Mercurial offers a combination command, \hgcmd{addremove}, that adds 1.51 +untracked files and marks missing files as removed. The 1.52 +\hgcmd{commit} command also provides a \hgopt{commit}{-A} option that 1.53 +performs an add-and-remove, immediately followed by a commit. This 1.54 +lets you replace the following command sequence: 1.55 +\begin{codesample2} 1.56 + hg add 1.57 + hg remove --after 1.58 + hg commit 1.59 +\end{codesample2} 1.60 +with a single command, \hgcmdargs{commit}{\hgopt{commit}{-A}}. 1.61 1.62 +\subsection{Renaming files} 1.63 + 1.64 +To rename a file that is tracked by Mercurial, use the \hgcmd{rename} 1.65 +command. This command behaves similarly to the Unix \command{mv} 1.66 +command. If the last argument is a directory, it moves all prior 1.67 +arguments into that directory. Otherwise, it renames a single file or 1.68 +directory to the name given in the last argument. 1.69 + 1.70 +As with \hgcmd{remove}, you can tell Mercurial about a rename after 1.71 +the fact using the \hgopt{remove}{--after} option. 1.72 + 1.73 +The na\"{i}ve way to ``rename'' a file is simply to rename the file 1.74 +yourself, \hgcmd{remove} the old name, and \hgcmd{add} the new name. 1.75 +However, if you do this, Mercurial will not know that there was any 1.76 +relationship between the files in question, and it will not be able to 1.77 +merge 1.78 + 1.79 +\subsection{Copying files} 1.80 + 1.81 +You can copy a file in two ways using mercurial. If you simply copy a 1.82 +file and then \hgcmd{add} the new file, Mercurial will not know that 1.83 +there was any relationship between the two files. However, if you 1.84 1.85 %%% Local Variables: 1.86 %%% mode: latex