# HG changeset patch # User Jordi GutiƩrrez Hermoso # Date 1415243943 18000 # Node ID 882028e37e4a559a0efbd62d9f808e15886dd347 Add first session diff -r 000000000000 -r 882028e37e4a session1.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/session1.sh Wed Nov 05 22:19:03 2014 -0500 @@ -0,0 +1,100 @@ +#doitlive commentecho: true +#doitlive prompt: {user.blue}@{TTY.MAGENTA}mtlpyladies{TTY.RESET}:{dir.green}$ +#First let's do some configging... +hg config --edit + +#And our first repo +hg init planets +cd planets + +#Work on our first file +echo "Cold and dry, but everything is my favorite color" > mars.txt +ls +cat mars.txt + +# +#Several ways to get information about our current state +hg summary +hg status +hg diff + +# +#Add the file +hg add mars.txt + +# +#Let's see how the information changed! +hg summary +hg status +hg diff + +# +#And we commit the file +hg commit -m "Starting to think about Mars" + +hg summary +hg status +hg diff + +# +#Most excitingly, we have a log! +hg log + +echo "The two moons may be a problem for Wolfman" >> mars.txt + +#Adding more changes will show up differently +hg summary +hg status +hg diff + +hg commit -m "Concerns about Mars's moons on my furry friend" +hg log + +#Another change, this time adding another file... +echo "But the Mummy will appreciate the lack of humidity" >> mars.txt +echo "That big red spot is quite the storm." >> jupiter.txt +hg add jupiter.txt +ls +hg diff +hg commit -m "Thoughts about the climate" + +#Now that we have some history to speak of, let's explore it. +hg log --patch --verbose --graph +hg log -pvG +hg glog -pv +hg glog --patch --verbose --rev 1 +hg glog -pvr 1 + +hg diff -r 0 -r 2 +hg diff -r 1 -r 2 +hg diff --change 2 +hg diff -c 2 + +hg annotate mars.txt +hg ann --user --date --number --changeset mars.txt +hg ann -udnc --quiet mars.txt + +#Let's make some mistakes... +echo "We will need to manufacture our own oxygen" >> mars.txt +hg diff + +#Nah, never mind, we don't want to record this change, let's just throw it out +hg revert mars.txt +hg diff + +#Y'know what, let's actually restore this file to an older version +hg rev -r 0 mars.txt +hg diff + +#Hm, but why does that look changed? +hg rev mars.txt + +#Let's *move* around the history instead of just changing individual files +hg update --rev 0 +cat mars.txt +hg summ +hg glog +hg up -r 1 +cat mars.txt +hg summ +hg glog