Benutzer-Werkzeuge

Webseiten-Werkzeuge


becki:linux:mercurial_tips

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen Revision Vorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
becki:linux:mercurial_tips [2013-08-23 09:58]
becki
becki:linux:mercurial_tips [2018-05-15 15:49] (aktuell)
becki [Undoing Changes]
Zeile 122: Zeile 122:
 [[http://​mercurial.selenic.com/​wiki/​QuickStart#​Setting_up_a_new_Mercurial_project|Source]] [[http://​mercurial.selenic.com/​wiki/​QuickStart#​Setting_up_a_new_Mercurial_project|Source]]
  
 +==== Templates and Styles ==
 +
 +Log-like commands can be formatted with froatting strings, wich ar called templates. A style is simply a precanned template. Command to list all installed styles:
 +
 +  hg log --template list
 +
 +Command to incluce phase info into the log:
 +
 +  hg glog --template phases
 +  hg glog -T phases
  
 ==== Converting Repo from CVS == ==== Converting Repo from CVS ==
Zeile 131: Zeile 141:
 ==== Branching == ==== Branching ==
  
-See [[hg>​wiki/​TutorialClone|hg clone]]+Remommendation:​ Use internal branches, i.e. [[hg>​wiki/​Branch|hg branch]] and add a bookmark to each branch. Don't use [[hg>​wiki/​TutorialClone|hg clone]] ​or named branches for branching. 
 + 
 +See alo http://​stevelosh.com/​blog/​2009/​08/​a-guide-to-branching-in-mercurial/​ 
 + 
  
-(Note that there exists also a possibility for internal branches and merges.) 
  
 ==== Merging == ==== Merging ==
Zeile 196: Zeile 209:
   hg revert <​file1>​ [<​file2>​]   hg revert <​file1>​ [<​file2>​]
  
-Restores the files in the working directory to the state when they had been last commited. Much more options are posssible, see ''​hg help revert''​ [[http://​hgbook.red-bean.com/​read/​finding-and-fixing-mistakes.html#​id391367|Hgbook]] [[http://​mercurial.selenic.com/​wiki/​Revert|Wiki]]+Restores the files in the working directory to the state when they had been last commited. Much more options are posssible, see ''​hg help revert''​ [[http://​hgbook.red-bean.com/​read/​finding-and-fixing-mistakes.html#​id391367|Hgbook]] [[hg>wiki/​Revert|Wiki]]
  
 === Undo latest commit == === Undo latest commit ==
Zeile 214: Zeile 227:
 Use ''​clone -r <​revnumber>​ <old> <​new>''​ to create a repo which contains only the changesets until <​revnumber>​. Than throw away the original repo and use the cloned repo. Use ''​clone -r <​revnumber>​ <old> <​new>''​ to create a repo which contains only the changesets until <​revnumber>​. Than throw away the original repo and use the cloned repo.
  
 +=== History editing ==
 +
 +''​hg histedit''​ e.g. for merging serveral changesets into one. See [[hg>​wiki/​HisteditExtension|Wiki]]
 +
 +Wrong histeds may be reverted by ''​hg unbundle .hg/​strip-backup/<​backupfile>''​. This works for wrong ''​hg rebase''​s as well.
 ==== '​cherry-picking == ==== '​cherry-picking ==
  
Zeile 239: Zeile 257:
 hg qpush -a              # apply all patches to repo hg qpush -a              # apply all patches to repo
 </​code>​ </​code>​
 +
 +===== Collaboration models ==
 +
 +Basically there is [[hgbook>​collaborating-with-other-people.html#​id372641|Pull-only versus shared-push]] collaboration. See also [[hg>​wiki/​WorkingPractices]]
  
 ===== Publishing with Webserver == ===== Publishing with Webserver ==
Zeile 268: Zeile 290:
 Clone some repositories into ''/​home/​share/​hgroot''​ and point browser to ''​http://​localhost/​cgi-bin/​hgweb/''​ Clone some repositories into ''/​home/​share/​hgroot''​ and point browser to ''​http://​localhost/​cgi-bin/​hgweb/''​
  
-===== Todo ==+===== Working with Git Repositories ​== 
 + 
 +With the [[hg>​wiki/​HgGit|HgGit]] extension you can push/pull to/from a remote (or local) Git repo while doing all the work in a local Hg repo. A nice way to get around Git commands :-) 
 + 
 +See http://​hg-git.github.io/​ for more info. 
 + 
 +==== Install == 
 + 
 +HgGit needs dulwich. Both is available on www.slackbuilds.org 
 + 
 +==== Working with HgGit == 
 + 
 +Local repo (L) is hg, remote repo (R) is git. 
 +We want to push/pull to/from branch master on R 
 + 
 +FIXME Verify: 
 + 
 +  - L needs a (manually created) //​bookmark//​ ''​master''​ which tells HgGit to push to / pull from which branch on R. Checkout if that bookmark must point to tip in order to get pushed all commits! Checkout if the bookmark must be active on L! 
 +  - The //tag// ''​default/​master''​ is autmatically created and moved on L on every push to / pull from R 
 +  - In order to push from L to R, R must not be on the branch to which to L wants to push (see [[git#​push]]) 
 + 
 +See https://​www.mercurial-scm.org/​wiki/​HgGit 
 +==== Access Github == 
 + 
 +To push an existing Mercurial repository to Github: 
 +  - [[https://​help.github.com/​articles/​generating-ssh-keys/​|Import]] your public SSH key to Github 
 +  - [[https://​help.github.com/​articles/​create-a-repo/​|Create]] an empty repo, e.g. ''​foo''​ on Github 
 +  - Cd into your local Hg repo and do <​code>​ 
 +hg bookmark -r default master # make a bookmark of master for default, so a ref gets created 
 +hg push git+ssh://​git@github.com/​becki/​foo.git</​code>​
  
-  * Checkout the export/​import feature: http://​mercurial.selenic.com/​wiki/​TutorialExport 
  
becki/linux/mercurial_tips.1377251900.txt.gz · Zuletzt geändert: 2013-08-23 09:58 von becki

Impressum - Datenschutzerklärung