Mercurialインストール、geophotoのバックアップとってみる
sudo apt-get install mercurial
一発
mercurialの使い方はここみる
http://labs.unoh.net/2008/05/mercurial.html
mercurialリポジトリを同期して
MAGのUbuntuに置いてあるコレのバックアップを、家鯖(Debian on GLATAN)にとってみる。クローラとrailsが別のディレクトリにあるのが微妙だな
http://shokai.org/blog/archives/1533
cd ~/src/flickr-store hg init
ls -aしてみると.hgができてる
とりあえず全部addでリポジトリ登録してみる
hg add *
dbが巨大すぎて怒られた
db/geophotos: files over 10MB may cause memory and performance problems (use 'hg revert db/geophotos' to unadd the file)
それでも全部コミットしてみる。コメントを付けられる。
hg commit -m "hello commit"
家のGLANTANKにクローンしてみる。家のドメインがshokaihome.netだとすると(実際は違う)
cd ~/src hg clone flickr-store ssh://sho@shokaihome.net//home/sho/src/rails/flickr-store
hg clone クローン元 クローン先
hg initしたディレクトリを、リモートのshokaihome.netの中にクローン。
GLATANの方。updateするまで.hgの中にクローンしたデータが入っている
cd /home/sho/src/rails/flickr-store hg update
これで18個ぐらいまとめてファイルがコピーできた。
geophoto本体も同様に
hg init hg add * hg commit -m "first commit" cd ../ hg clone geophoto ssh://sho@shokaihome.net//home/sho/src/rails/geophoto cd geophoto hg push ssh://sho@shokaihome.net//home/sho/src/rails/geophoto
MAGのubuntuの方にファイルを追加してみる
testtext というテキストファイルを適当に置いてから、
cd ~/src/flickr-store hg add testtext hg commit -m "add testtext" testtext hg push ssh://sho@shokaihome.net//home/sho/src/rails/flickr-store
リポジトリ登録、commit、pushで家鯖に反映。
家のGLATANで
cd /home/sho/src/rails/flickr-store hg update
したらtesttextができてました。
やっぱりtesttextは邪魔なので削除する。
rm testtext
これだけだとリポジトリから削除されたわけじゃなくて、hg statusコマンドすると!マークがついていて「管理ファイルが見つからない」という状態になる
http://randt.jp/?page_id=262
リポジトリからも削除する
hg remove testtext
hg statusでRマークがついて削除になっていればok
削除をコミット、家鯖にもpushする
hg commit -m "removed testtext" hg push ssh://sho@shokaihome.net//home/sho/src/rails/flickr-store
家鯖側。updateするとtesttextも削除される。削除されてもバージョン管理されてるらしいので、戻せるらしい
hg update