hgbook

changeset 43:7ac85766db0f

Rename, remove.
author Bryan O'Sullivan <bos@serpentine.com>
date Sun Jul 23 12:21:36 2006 -0700 (2006-07-23)
parents cbfa08bcf181
children 012df94a02fe
files en/Makefile en/daily.tex en/examples/daily.files
line diff
     1.1 --- a/en/Makefile	Sun Jul 23 09:46:26 2006 -0700
     1.2 +++ b/en/Makefile	Sun Jul 23 12:21:36 2006 -0700
     1.3 @@ -18,6 +18,7 @@
     1.4  
     1.5  example-sources := \
     1.6  	examples/run-example \
     1.7 +	examples/daily.files \
     1.8  	examples/hook.simple \
     1.9  	examples/mq.qinit-help \
    1.10  	examples/mq.diff \
     2.1 --- a/en/daily.tex	Sun Jul 23 09:46:26 2006 -0700
     2.2 +++ b/en/daily.tex	Sun Jul 23 12:21:36 2006 -0700
     2.3 @@ -50,12 +50,12 @@
     2.4  ``hidden'' file to that directory.  On Unix-like systems, any file
     2.5  name that begins with a period (``\texttt{.}'') is treated as hidden
     2.6  by most commands and GUI tools.  This approach is illustrated in
     2.7 -figure~\ref{ex:daily:empty}.
     2.8 +figure~\ref{ex:daily:hidden}.
     2.9  
    2.10  \begin{figure}[ht]
    2.11 -  \interaction{daily.files.empty}
    2.12 -  \caption{Simulating an empty directory}
    2.13 -  \label{ex:daily:empty}
    2.14 +  \interaction{daily.files.hidden}
    2.15 +  \caption{Simulating an empty directory using a hidden file}
    2.16 +  \label{ex:daily:hidden}
    2.17  \end{figure}
    2.18  
    2.19  Another way to tackle a need for an empty directory is to simply
    2.20 @@ -65,7 +65,8 @@
    2.21  
    2.22  If you decide that a file no longer belongs in your repository, use
    2.23  the \hgcmd{remove} command; this deletes the file, and tells Mercurial
    2.24 -to stop tracking it.
    2.25 +to stop tracking it.  A removed file is represented in the output of
    2.26 +\hgcmd{status} with a ``\texttt{R}''.
    2.27  
    2.28  You might wonder why Mercurial requires you to explicitly tell it that
    2.29  you are deleting a file.  Earlier during the development of Mercurial,
    2.30 @@ -74,13 +75,53 @@
    2.31  tracking the file.  In practice, this made it too easy to accidentally
    2.32  stop Mercurial from tracking a file.
    2.33  
    2.34 -If you forget to run \hgcmd{remove} to delete a file, you can run
    2.35 -\hgcmdopts{remove}{--after} later on, to tell Mercurial that you
    2.36 -deleted the file.
    2.37 +Mercurial considers a file that you have deleted, but not used
    2.38 +\hgcmd{remove} to delete, to be \emph{missing}.  A missing file is
    2.39 +represented with ``\texttt{!}'' in the output of \hgcmd{status}.
    2.40 +Other Mercurial commands will not do anything with missing files.
    2.41 +
    2.42 +If you have a missing file in your repository, you can run
    2.43 +\hgcmdargs{remove}{\hgopt{remove}{--after}} later on, to tell
    2.44 +Mercurial that you deleted the file.  If you deleted the file by
    2.45 +accident, use \hgcmdargs{revert}{\emph{filename}} to restore the file
    2.46 +to its last committed state.
    2.47  
    2.48  \subsection{Useful shorthand---adding and removing files in one step}
    2.49  
    2.50 +Mercurial offers a combination command, \hgcmd{addremove}, that adds
    2.51 +untracked files and marks missing files as removed.  The
    2.52 +\hgcmd{commit} command also provides a \hgopt{commit}{-A} option that
    2.53 +performs an add-and-remove, immediately followed by a commit.  This
    2.54 +lets you replace the following command sequence:
    2.55 +\begin{codesample2}
    2.56 +  hg add
    2.57 +  hg remove --after
    2.58 +  hg commit
    2.59 +\end{codesample2}
    2.60 +with a single command, \hgcmdargs{commit}{\hgopt{commit}{-A}}.
    2.61  
    2.62 +\subsection{Renaming files}
    2.63 +
    2.64 +To rename a file that is tracked by Mercurial, use the \hgcmd{rename}
    2.65 +command.  This command behaves similarly to the Unix \command{mv}
    2.66 +command.  If the last argument is a directory, it moves all prior
    2.67 +arguments into that directory.  Otherwise, it renames a single file or
    2.68 +directory to the name given in the last argument.
    2.69 +
    2.70 +As with \hgcmd{remove}, you can tell Mercurial about a rename after
    2.71 +the fact using the \hgopt{remove}{--after} option.
    2.72 +
    2.73 +The na\"{i}ve way to ``rename'' a file is simply to rename the file
    2.74 +yourself, \hgcmd{remove} the old name, and \hgcmd{add} the new name.
    2.75 +However, if you do this, Mercurial will not know that there was any
    2.76 +relationship between the files in question, and it will not be able to
    2.77 +merge
    2.78 +
    2.79 +\subsection{Copying files}
    2.80 +
    2.81 +You can copy a file in two ways using mercurial.  If you simply copy a
    2.82 +file and then \hgcmd{add} the new file, Mercurial will not know that
    2.83 +there was any relationship between the two files.  However, if you 
    2.84  
    2.85  %%% Local Variables: 
    2.86  %%% mode: latex
     3.1 --- a/en/examples/daily.files	Sun Jul 23 09:46:26 2006 -0700
     3.2 +++ b/en/examples/daily.files	Sun Jul 23 12:21:36 2006 -0700
     3.3 @@ -1,4 +1,4 @@
     3.4 -#$ name: status
     3.5 +#$ name: add
     3.6  
     3.7  hg init a
     3.8  cd a