hgbook / ja / examples / daily.files

#!/bin/bash

#$ name: add

hg init add-example
cd add-example
echo a > a
hg status
hg add a
hg status
hg commit -m 'Added one file'
hg status

#$ name: add-dir

mkdir b
echo b > b/b
echo c > b/c
mkdir b/d
echo d > b/d/d
hg add b
hg commit -m 'Added all files in subdirectory'

#$ name:

cd ..

#$ name: hidden

hg init hidden-example
cd hidden-example
mkdir empty
touch empty/.hidden
hg add empty/.hidden
hg commit -m 'Manage an empty-looking directory'
ls empty
cd ..
hg clone hidden-example tmp
ls tmp
ls tmp/empty

#$ name: remove

hg init remove-example
cd remove-example
echo a > a
mkdir b
echo b > b/b
hg add a b
hg commit -m 'Small example for file removal'
hg remove a
hg status
hg remove b

#$ name:

cd ..

#$ name: missing
hg init missing-example
cd missing-example
echo a > a
hg add a
hg commit -m 'File about to be missing'
rm a
hg status

#$ name: remove-after

hg remove --after a
hg status

#$ name: recover-missing
hg revert a
cat a
hg status

#$ name:

cd ..

#$ name: addremove

hg init addremove-example
cd addremove-example
echo a > a
echo b > b
hg addremove

#$ name: commit-addremove

echo c > c
hg commit -A -m 'Commit with addremove'
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.