SlideShare une entreprise Scribd logo
1  sur  9
Télécharger pour lire hors ligne
Migration
         from
Subversion to Mercurial
          Ladislav Prskavec
      http://blog.prskavec.net
   ladislav.prskavec@gmail.com



   OpenMeeting 27.9.2009
Why Mercurial ?

   Bitbucket.org (php-frameworks.net)
   Google Code (php4hudson, phpchangelogs)
   Keywords (phpdoc, git not support)
   Revisions (git not support)
   Netbeans (native support)
   Eclipse plugin (Zend Studio)
       http://www.vectrace.com/mercurialeclipse/
   Many extensions

Negatives
  partial rebase (extension)
  experimental subrepos in Mercurial 1.3.1 (svn:externals)
Why Mercurial ?
Bitbucket.org (private rep, issues)
SVN xml logs to Hg

Question: How make svn log --xml

Answer: hglog.sh
echo '<?xml version="1.0"?>n<log>n' >$1.xml
hg log --template '<logentry revision="{rev}">
<author>{author|obfuscate}</author>
<date>{date|isodate}</date>
<msg>{desc|escape}n</msg>
<paths><path>{files}</path></paths>
</logentry>n' $1/ >>$1.xml
echo '</log>n' >>$1.xml
RCS keywords

Question: How make keywords?

Answer: Keywords extension (part from .hgrc)
[extensions]
hgext.keyword =
keyword=/usr/share/python-support/mercurial-common/hgext/keyword.py
[keyword]
**.php =
**.xml =
[keywordmaps]
RCSFile = {file|basename},v
Author = {author|user}
Header = {root}/{file},v {node|short} {date|utcdate} {author|user}
Source = {root}/{file},v
Date = {date|utcdate}
Id = {file|basename},v {node|short} {date|utcdate} {author|user}
Revision = {node|short}
Deployment

SVN deployment script

svn --force export http://svn.rep.cz/svn/project/trunk/ /srv/www/project.cz/
/usr/bin/svn2cl --strip-prefix=trunk --break-before-msg=2 --group-by-day --separate-daylogs -i --
authors=/srv/www/project.cz/application/configs/authors.xml http://svn.rep.cz/svn/project/trunk -o /srv/www/project.
cz/changelog
sed -i 's/development/production/g' /srv/www/project.cz/public/.htaccess
chown -Rf www-data:www-data /srv/www/project.cz/


Mercurial deployment script

cd ~/hg-ws/project.cz/
hg pull
hg up
hg archive /srv/www/project.cz/
sed -i 's/development/production/g' /srv/www/project.cz/public/.htaccess
chown -Rf www-data:www-data /srv/www/project.cz/
Hooks scripts

Subversion (server, repos/hooks/pre-commit)
#!/bin/sh
REPOS="$1"
TXN="$2"
# check php
CHANGED=`svnlook changed -t "$TXN" "$REPOS" | awk '{print $2}' | grep .php$`

for FILE in $CHANGED
do
MESSAGE=`svnlook cat -t "$TXN" "$REPOS" "$FILE" | $PHP -l `
if [ $? -ne 0 ]
then
exit 1
fi
done
exit 0


Mercurial (in .hg/hgrc)
[hooks]
precommit = test `find -name *.php -exec php -l {} ; | wc -l` -eq 1
Summary

Evolution not revolution
Some workflow for my projects in Mercurial and Svn
Local commits
hg backout
hg rollback (working only localy)
Check extensions
   http://mercurial.selenic.com/wiki/UsingExtensions
      Convert (from others SCM: cvs, svn, git, darcs, bzr, arch, mnt)
      Fetch
      Keyword
      Notify
      Rebase
      Record (staging area)
Thanks for your attention

http://slideshare.net/ladislavprskavec


           Ladislav Prskavec
       http://blog.prskavec.net
    ladislav.prskavec@gmail.com

Contenu connexe

Tendances

Inside Sqale's Backend at Sapporo Ruby Kaigi 2012
Inside Sqale's Backend at Sapporo Ruby Kaigi 2012Inside Sqale's Backend at Sapporo Ruby Kaigi 2012
Inside Sqale's Backend at Sapporo Ruby Kaigi 2012
Gosuke Miyashita
 

Tendances (20)

Inside Sqale's Backend at Sapporo Ruby Kaigi 2012
Inside Sqale's Backend at Sapporo Ruby Kaigi 2012Inside Sqale's Backend at Sapporo Ruby Kaigi 2012
Inside Sqale's Backend at Sapporo Ruby Kaigi 2012
 
NginX - good practices, tips and advanced techniques
NginX - good practices, tips and advanced techniquesNginX - good practices, tips and advanced techniques
NginX - good practices, tips and advanced techniques
 
KubeCon EU 2016: Getting the Jobs Done With Kubernetes
KubeCon EU 2016: Getting the Jobs Done With KubernetesKubeCon EU 2016: Getting the Jobs Done With Kubernetes
KubeCon EU 2016: Getting the Jobs Done With Kubernetes
 
CoreOS + Kubernetes @ All Things Open 2015
CoreOS + Kubernetes @ All Things Open 2015CoreOS + Kubernetes @ All Things Open 2015
CoreOS + Kubernetes @ All Things Open 2015
 
Big Data Day LA 2016/ Big Data Track - Fluentd and Embulk: Collect More Data,...
Big Data Day LA 2016/ Big Data Track - Fluentd and Embulk: Collect More Data,...Big Data Day LA 2016/ Big Data Track - Fluentd and Embulk: Collect More Data,...
Big Data Day LA 2016/ Big Data Track - Fluentd and Embulk: Collect More Data,...
 
用 Go 語言打造多台機器 Scale 架構
用 Go 語言打造多台機器 Scale 架構用 Go 語言打造多台機器 Scale 架構
用 Go 語言打造多台機器 Scale 架構
 
Containers: What are they, Really?
Containers: What are they, Really?Containers: What are they, Really?
Containers: What are they, Really?
 
Becoming a Git Master
Becoming a Git MasterBecoming a Git Master
Becoming a Git Master
 
Lua tech talk
Lua tech talkLua tech talk
Lua tech talk
 
Docker orchestration v4
Docker orchestration v4Docker orchestration v4
Docker orchestration v4
 
Docker command
Docker commandDocker command
Docker command
 
Docker remote-api
Docker remote-apiDocker remote-api
Docker remote-api
 
What Have Syscalls Done for you Lately?
What Have Syscalls Done for you Lately?What Have Syscalls Done for you Lately?
What Have Syscalls Done for you Lately?
 
DPNHTW
DPNHTWDPNHTW
DPNHTW
 
OpenShift4 Installation by UPI on kvm
OpenShift4 Installation by UPI on kvmOpenShift4 Installation by UPI on kvm
OpenShift4 Installation by UPI on kvm
 
Quay 3.3 installation
Quay 3.3 installationQuay 3.3 installation
Quay 3.3 installation
 
Fluentd - CNCF Paris
Fluentd - CNCF ParisFluentd - CNCF Paris
Fluentd - CNCF Paris
 
CoreOS in a Nutshell
CoreOS in a NutshellCoreOS in a Nutshell
CoreOS in a Nutshell
 
Using ngx_lua in UPYUN
Using ngx_lua in UPYUNUsing ngx_lua in UPYUN
Using ngx_lua in UPYUN
 
Ansible with AWS
Ansible with AWSAnsible with AWS
Ansible with AWS
 

En vedette (6)

Zend Framework
Zend FrameworkZend Framework
Zend Framework
 
SVN základy
SVN základySVN základy
SVN základy
 
What We Learned On the Way to the Ballot Box
What We Learned On the Way to the Ballot BoxWhat We Learned On the Way to the Ballot Box
What We Learned On the Way to the Ballot Box
 
Tessel is a microcontroller that runs JavaScript.
Tessel is a microcontroller that runs JavaScript.Tessel is a microcontroller that runs JavaScript.
Tessel is a microcontroller that runs JavaScript.
 
Darren Sprute Portfolio
Darren Sprute PortfolioDarren Sprute Portfolio
Darren Sprute Portfolio
 
Lee Technologies Corporate Brochure
Lee Technologies Corporate BrochureLee Technologies Corporate Brochure
Lee Technologies Corporate Brochure
 

Similaire à Subversion To Mercurial

Using Git as your VCS with Bioconductor
Using Git as your VCS with BioconductorUsing Git as your VCS with Bioconductor
Using Git as your VCS with Bioconductor
timyates
 
Painless Perl Ports with cpan2port
Painless Perl Ports with cpan2portPainless Perl Ports with cpan2port
Painless Perl Ports with cpan2port
Benny Siegert
 
Tips
TipsTips
Tips
mclee
 
From Code to Cloud - PHP on Red Hat's OpenShift
From Code to Cloud - PHP on Red Hat's OpenShiftFrom Code to Cloud - PHP on Red Hat's OpenShift
From Code to Cloud - PHP on Red Hat's OpenShift
Eric D. Schabell
 

Similaire à Subversion To Mercurial (20)

빈스톡 첫인상 with Git
빈스톡 첫인상 with Git빈스톡 첫인상 with Git
빈스톡 첫인상 with Git
 
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
 
Using Git as your VCS with Bioconductor
Using Git as your VCS with BioconductorUsing Git as your VCS with Bioconductor
Using Git as your VCS with Bioconductor
 
Painless Perl Ports with cpan2port
Painless Perl Ports with cpan2portPainless Perl Ports with cpan2port
Painless Perl Ports with cpan2port
 
Deployment Tactics
Deployment TacticsDeployment Tactics
Deployment Tactics
 
Debugging: Rules And Tools - PHPTek 11 Version
Debugging: Rules And Tools - PHPTek 11 VersionDebugging: Rules And Tools - PHPTek 11 Version
Debugging: Rules And Tools - PHPTek 11 Version
 
Devopstore
DevopstoreDevopstore
Devopstore
 
Intro django
Intro djangoIntro django
Intro django
 
Exploring Async PHP (SF Live Berlin 2019)
Exploring Async PHP (SF Live Berlin 2019)Exploring Async PHP (SF Live Berlin 2019)
Exploring Async PHP (SF Live Berlin 2019)
 
An OpenShift Primer for Developers to get your Code into the Cloud (PTJUG)
An OpenShift Primer for Developers to get your Code into the Cloud (PTJUG)An OpenShift Primer for Developers to get your Code into the Cloud (PTJUG)
An OpenShift Primer for Developers to get your Code into the Cloud (PTJUG)
 
Scaling up development of a modular code base
Scaling up development of a modular code baseScaling up development of a modular code base
Scaling up development of a modular code base
 
Scaling up development of a modular code base - R Munteanu
Scaling up development of a modular code base - R MunteanuScaling up development of a modular code base - R Munteanu
Scaling up development of a modular code base - R Munteanu
 
Happy porting x86 application to android
Happy porting x86 application to androidHappy porting x86 application to android
Happy porting x86 application to android
 
Tdc 2013 - Ecossistema Ruby
Tdc 2013 - Ecossistema RubyTdc 2013 - Ecossistema Ruby
Tdc 2013 - Ecossistema Ruby
 
Tips
TipsTips
Tips
 
Toolbox of a Ruby Team
Toolbox of a Ruby TeamToolbox of a Ruby Team
Toolbox of a Ruby Team
 
From Code to Cloud - PHP on Red Hat's OpenShift
From Code to Cloud - PHP on Red Hat's OpenShiftFrom Code to Cloud - PHP on Red Hat's OpenShift
From Code to Cloud - PHP on Red Hat's OpenShift
 
Introduction to PowerShell
Introduction to PowerShellIntroduction to PowerShell
Introduction to PowerShell
 
Subversionn Introduction at SuperMondays 2009-09-01
Subversionn Introduction at SuperMondays 2009-09-01Subversionn Introduction at SuperMondays 2009-09-01
Subversionn Introduction at SuperMondays 2009-09-01
 
Mercurial for Kittens
Mercurial for KittensMercurial for Kittens
Mercurial for Kittens
 

Plus de Ladislav Prskavec

Plus de Ladislav Prskavec (20)

SRE in Apiary
SRE in ApiarySRE in Apiary
SRE in Apiary
 
Modern Web Architecture<br>based on JS, API and Markup
Modern Web Architecture<br>based on JS, API and MarkupModern Web Architecture<br>based on JS, API and Markup
Modern Web Architecture<br>based on JS, API and Markup
 
How you can kill Wordpress!
How you can kill Wordpress!How you can kill Wordpress!
How you can kill Wordpress!
 
SRE in Startup
SRE in StartupSRE in Startup
SRE in Startup
 
CI and CD
CI and CDCI and CD
CI and CD
 
Datascript: Serverless Architetecture
Datascript: Serverless ArchitetectureDatascript: Serverless Architetecture
Datascript: Serverless Architetecture
 
Serverless Architecture
Serverless ArchitectureServerless Architecture
Serverless Architecture
 
CI and CD
CI and CDCI and CD
CI and CD
 
PragueJS meetups 30th anniversary
PragueJS meetups 30th anniversaryPragueJS meetups 30th anniversary
PragueJS meetups 30th anniversary
 
How to easy deploy app into any cloud
How to easy deploy app into any cloudHow to easy deploy app into any cloud
How to easy deploy app into any cloud
 
Docker - modern platform for developement and operations
Docker - modern platform for developement and operationsDocker - modern platform for developement and operations
Docker - modern platform for developement and operations
 
GDGSCL - Docker a jeho provoz v Heroku a AWS
GDGSCL - Docker a jeho provoz v Heroku a AWSGDGSCL - Docker a jeho provoz v Heroku a AWS
GDGSCL - Docker a jeho provoz v Heroku a AWS
 
AWS Elastic Container Service
AWS Elastic Container ServiceAWS Elastic Container Service
AWS Elastic Container Service
 
Comparison nodejs frameworks using Polls API
Comparison nodejs frameworks using Polls APIComparison nodejs frameworks using Polls API
Comparison nodejs frameworks using Polls API
 
Docker Elastic Beanstalk
Docker Elastic BeanstalkDocker Elastic Beanstalk
Docker Elastic Beanstalk
 
Docker včera, dnes a zítra
Docker včera, dnes a zítraDocker včera, dnes a zítra
Docker včera, dnes a zítra
 
Docker.io
Docker.ioDocker.io
Docker.io
 
Docker.io
Docker.ioDocker.io
Docker.io
 
AngularJS
AngularJSAngularJS
AngularJS
 
Firebase and AngularJS
Firebase and AngularJSFirebase and AngularJS
Firebase and AngularJS
 

Dernier

Dernier (20)

Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджера
 
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
 
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeFree and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
 
The UX of Automation by AJ King, Senior UX Researcher, Ocado
The UX of Automation by AJ King, Senior UX Researcher, OcadoThe UX of Automation by AJ King, Senior UX Researcher, Ocado
The UX of Automation by AJ King, Senior UX Researcher, Ocado
 
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCustom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
 
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
 
Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024
 
ECS 2024 Teams Premium - Pretty Secure
ECS 2024   Teams Premium - Pretty SecureECS 2024   Teams Premium - Pretty Secure
ECS 2024 Teams Premium - Pretty Secure
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
 
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfWhere to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
 
Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
 
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
 
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM Performance
 
THE BEST IPTV in GERMANY for 2024: IPTVreel
THE BEST IPTV in  GERMANY for 2024: IPTVreelTHE BEST IPTV in  GERMANY for 2024: IPTVreel
THE BEST IPTV in GERMANY for 2024: IPTVreel
 
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
 

Subversion To Mercurial

  • 1. Migration from Subversion to Mercurial Ladislav Prskavec http://blog.prskavec.net ladislav.prskavec@gmail.com OpenMeeting 27.9.2009
  • 2. Why Mercurial ? Bitbucket.org (php-frameworks.net) Google Code (php4hudson, phpchangelogs) Keywords (phpdoc, git not support) Revisions (git not support) Netbeans (native support) Eclipse plugin (Zend Studio) http://www.vectrace.com/mercurialeclipse/ Many extensions Negatives partial rebase (extension) experimental subrepos in Mercurial 1.3.1 (svn:externals)
  • 3. Why Mercurial ? Bitbucket.org (private rep, issues)
  • 4. SVN xml logs to Hg Question: How make svn log --xml Answer: hglog.sh echo '<?xml version="1.0"?>n<log>n' >$1.xml hg log --template '<logentry revision="{rev}"> <author>{author|obfuscate}</author> <date>{date|isodate}</date> <msg>{desc|escape}n</msg> <paths><path>{files}</path></paths> </logentry>n' $1/ >>$1.xml echo '</log>n' >>$1.xml
  • 5. RCS keywords Question: How make keywords? Answer: Keywords extension (part from .hgrc) [extensions] hgext.keyword = keyword=/usr/share/python-support/mercurial-common/hgext/keyword.py [keyword] **.php = **.xml = [keywordmaps] RCSFile = {file|basename},v Author = {author|user} Header = {root}/{file},v {node|short} {date|utcdate} {author|user} Source = {root}/{file},v Date = {date|utcdate} Id = {file|basename},v {node|short} {date|utcdate} {author|user} Revision = {node|short}
  • 6. Deployment SVN deployment script svn --force export http://svn.rep.cz/svn/project/trunk/ /srv/www/project.cz/ /usr/bin/svn2cl --strip-prefix=trunk --break-before-msg=2 --group-by-day --separate-daylogs -i -- authors=/srv/www/project.cz/application/configs/authors.xml http://svn.rep.cz/svn/project/trunk -o /srv/www/project. cz/changelog sed -i 's/development/production/g' /srv/www/project.cz/public/.htaccess chown -Rf www-data:www-data /srv/www/project.cz/ Mercurial deployment script cd ~/hg-ws/project.cz/ hg pull hg up hg archive /srv/www/project.cz/ sed -i 's/development/production/g' /srv/www/project.cz/public/.htaccess chown -Rf www-data:www-data /srv/www/project.cz/
  • 7. Hooks scripts Subversion (server, repos/hooks/pre-commit) #!/bin/sh REPOS="$1" TXN="$2" # check php CHANGED=`svnlook changed -t "$TXN" "$REPOS" | awk '{print $2}' | grep .php$` for FILE in $CHANGED do MESSAGE=`svnlook cat -t "$TXN" "$REPOS" "$FILE" | $PHP -l ` if [ $? -ne 0 ] then exit 1 fi done exit 0 Mercurial (in .hg/hgrc) [hooks] precommit = test `find -name *.php -exec php -l {} ; | wc -l` -eq 1
  • 8. Summary Evolution not revolution Some workflow for my projects in Mercurial and Svn Local commits hg backout hg rollback (working only localy) Check extensions http://mercurial.selenic.com/wiki/UsingExtensions Convert (from others SCM: cvs, svn, git, darcs, bzr, arch, mnt) Fetch Keyword Notify Rebase Record (staging area)
  • 9. Thanks for your attention http://slideshare.net/ladislavprskavec Ladislav Prskavec http://blog.prskavec.net ladislav.prskavec@gmail.com