Mercurial > hg
view tests/svn/svndump-encoding.sh @ 33087:fcd1c483f5ea
strip: add a delayedstrip method that works in a transaction
For long, the fact that strip does not work inside a transaction and some
code has to work with both obsstore and fallback to strip lead to duplicated
code like:
with repo.transaction():
....
if obsstore:
obsstore.createmarkers(...)
if not obsstore:
repair.strip(...)
Things get more complex when you want to call something which may call strip
under the hood. Like you cannot simply write:
with repo.transaction():
....
rebasemod.rebase(...) # may call "strip", so this doesn't work
But you do want rebase to run inside a same transaction if possible, so the
code may look like:
with repo.transaction():
....
if obsstore:
rebasemod.rebase(...)
obsstore.createmarkers(...)
if not obsstore:
rebasemod.rebase(...)
repair.strip(...)
That's ugly and error-prone. Ideally it's possible to just write:
with repo.transaction():
rebasemod.rebase(...)
saferemovenodes(...)
This patch is the first step towards that. It adds a "delayedstrip" method
to repair.py which maintains a postclose callback in the transaction object.
author | Jun Wu <quark@fb.com> |
---|---|
date | Sun, 25 Jun 2017 10:38:45 -0700 |
parents | f3398f1f70a0 |
children |
line wrap: on
line source
#!/bin/sh # -*- coding: utf-8 -*- # # Use this script to generate encoding.svndump # mkdir temp cd temp mkdir project-orig cd project-orig mkdir trunk mkdir branches mkdir tags cd .. svnadmin create svn-repo svnurl=file://`pwd`/svn-repo svn import project-orig $svnurl -m "init projA" svn co $svnurl project cd project echo e > trunk/é mkdir trunk/à echo d > trunk/à/é svn add trunk/é trunk/à svn ci -m hello # Copy files and directories svn mv trunk/é trunk/è svn mv trunk/à trunk/ù svn ci -m "copy files" # Remove files svn rm trunk/è svn rm trunk/ù svn ci -m 'remove files' # Create branches with and from weird names svn up svn cp trunk branches/branché echo a > branches/branché/a svn ci -m 'branch to branché' svn up svn cp branches/branché branches/branchée echo a >> branches/branché/a svn ci -m 'branch to branchée' # Create tag with weird name svn up svn cp trunk tags/branché svn ci -m 'tag trunk' svn cp branches/branchée tags/branchée svn ci -m 'tag branché' cd .. svnadmin dump svn-repo > ../encoding.svndump