changeset 253:6839cd949165

Handling renames
author Martin Geisler <mg@lazybytes.net>
date Sun, 21 Nov 2010 21:22:37 +0100
parents f73da41a4f51
children 33b6c73e487e
files rename-guessing.tex renames-and-merges.tex vendor-branches.tex
diffstat 3 files changed, 85 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
new file mode 100644
--- /dev/null
+++ b/rename-guessing.tex
@@ -0,0 +1,21 @@
+\begin{frame}[fragile]{Importing a Code Drop}
+  Mercurial can help you:
+\begin{lstlisting}
+$ rm -r lib/libfoo
+$ unzip libfoo-2.0.zip -d lib/libfoo
+$ hg status
+M lib/libfoo/modified.txt
+! lib/libfoo/deleted.txt
+? lib/libfoo/new.txt
+\end{lstlisting}
+
+\pause
+
+Question: has \ext{deleted.txt} been renamed to \ext{new.txt}?
+\begin{lstlisting}
+$ hg addremove --similarity 90
+removing deleted.txt
+adding new.txt
+recording removal of deleted.txt as rename to new.txt (94% similar)
+\end{lstlisting}
+\end{frame}
new file mode 100644
--- /dev/null
+++ b/renames-and-merges.tex
@@ -0,0 +1,60 @@
+\begin{frame}[fragile]{Finding Renamed Files}
+  Tracking renames is important:
+  \begin{itemize}
+  \item you fix a bug in \ext{X.java} in version 1.0
+  \item version 2.0 now uses \ext{Y.java} instead of \ext{Y.java}
+  \item Mercurial does the right thing with rename tracking
+  \end{itemize}
+
+  \begin{tikzpicture}[node distance=4.7mm]
+    \lstset{
+      language=Java,
+      aboveskip=0pt,
+      belowskip=0pt,
+      backgroundcolor={},
+      frame=none,
+      moredelim=**[is][\bfseries\color{red!80!black}]{|}{|}
+    }
+    \tikzstyle{listing}=[text width=30.15mm, draw, fill=black!5!white, drop shadow]
+    \node[listing, label=above:\ext{X.java}] (v1) at (0, 0) {
+\begin{lstlisting}
+public class X {
+  static int
+    theAnswer = 41;
+}
+\end{lstlisting}
+};
+
+    \node[listing, label=above:\ext{Y.java}, right=of v1, yshift=+15mm] (v2) {
+\begin{lstlisting}
+public class |Y| {
+  static int
+    theAnswer = 41;
+}
+\end{lstlisting}
+};
+
+    \node[listing, label=above:\ext{X.java}, right=of v1, yshift=-15mm] (fix) {
+\begin{lstlisting}
+public class X {
+  static int
+    theAnswer = |42|;
+}
+\end{lstlisting}
+};
+
+    \node[listing, label=above:\ext{Y.java}, right=of fix, yshift=15mm] (merge) {
+\begin{lstlisting}
+public class |Y| {
+  static int
+    theAnswer = |42|;
+}
+\end{lstlisting}
+};
+
+    \draw[->, short] (v1) to[bend left] node[above left] {rename} (v2);
+    \draw[->, short] (v1) to[bend right] node[below left] {bugfix} (fix);
+    \draw[->, short] (v2) to[bend left] (merge);
+    \draw[->, short] (fix) to[bend right] (merge);
+  \end{tikzpicture}
+\end{frame}
--- a/vendor-branches.tex
+++ b/vendor-branches.tex
@@ -56,6 +56,10 @@
 \include{merge-details}
 \include{merging-vendor-branches}
 
+\subsection{Handling Renamed Files}
+\include{rename-guessing}
+\include{renames-and-merges}
+
 \section{Wrapping Up}
 
 \include{links}