Commits

Bryan O'Sullivan committed 72d2079

Tour: push.

Comments (0)

Files changed (2)

 
 hg update 2
 hg parents
+
+#$ name: clone-push
+
+cd ..
+hg clone hello hello-push
+
+#$ name: outgoing
+
+cd my-hello
+hg outgoing ../hello-push
+
+#$ name: push
+
+hg push ../hello-push
+
+#$ name: push.nothing
+
+hg push ../hello-push
 \interaction{tour.pull}
 As you can see from the before-and-after output of \hgcmd{tip}, we
 have successfully pulled changes into our repository.  There remains
-one step before we can work with those changes.
+one step before we can see these changes in the working directory.
 
-\section{Updating the working directory}
+\subsection{Updating the working directory}
 
-We have so far glossed over the relatioship between a repository and
+We have so far glossed over the relationship between a repository and
 its working directory.  The \hgcmd{pull} command that we ran in
 section~\ref{sec:tour:pull} brought changes into the repository, but
 if we check, there's no sign of those changes in the working
 \begin{codesample2}
   hg pull -u
 \end{codesample2}
+If you look back at the output of \hgcmd{pull} in
+section~\ref{sec:tour:pull} when we ran it without \hgopt{pull}{-u},
+you can see that it printed a helpful reminder that we'd have to take
+an explicit step to update the working directory:
+\begin{codesample2}
+  (run 'hg update' to get a working copy)
+\end{codesample2}
 
 To find out what revision the working directory is at, use the
 \hgcmd{parents} command.
 If you omit an explicit revision, \hgcmd{update} will update to the
 tip revision.
 
+\subsection{Pushing changes to another repository}
+
+Mercurial lets us push changes to another repository, from the
+repository we're currently visiting.  As with the example of
+\hgcmd{pull} above, we'll create a temporary repository to push our
+changes into.
+\interaction{tour.clone-push}
+The \hgcmd{outgoing} command tells us what changes would be pushed
+into another repository.
+\interaction{tour.outgoing}
+And the \hgcmd{push} command does the actual push.
+\interaction{tour.push}
+As with \hgcmd{pull}, the \hgcmd{push} command does not update the
+working directory in the repository that it's pushing changes into.
+(Unlike \hgcmd{pull}, \hgcmd{push} does not provide a \texttt{-u}
+option that updates the other repository's working directory.)
+
+What happens if we try to pull or push changes and the receiving
+repository already has those changes?  Nothing too exciting.
+\interaction{tour.push.nothing}
+
 %%% Local Variables: 
 %%% mode: latex
 %%% TeX-master: "00book"
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.