copytrace: adding ui config to allow incremental deployment

Summary: adding ui config to allow deploying first the 'filling the client database' then 'pushing to and pushing from the server database' and finally the 'copytracing' part

Test Plan: adding those ui configs, the former tests still pass

Reviewers: #sourcecontrol, rmcelroy

Differential Revision: https://phabricator.fb.com/D2672217

Tasks: 8660367
This commit is contained in:
Cecile Berillon 2015-11-20 09:38:21 -08:00
parent b3ca500f64
commit 5469a4c044
6 changed files with 28 additions and 14 deletions

View File

@ -7,13 +7,16 @@ import bundle2
def extsetup(ui): def extsetup(ui):
wrapfunction(cmdutil, 'commit', filldb.commit) if ui.configbool("copytrace", "enablefilldb", False):
wrapfunction(cmdutil, 'amend', filldb.amend) wrapfunction(cmdutil, 'commit', filldb.commit)
wrapfunction(rebase, 'concludenode', filldb.concludenode) wrapfunction(cmdutil, 'amend', filldb.amend)
wrapfunction(rebase, 'concludenode', filldb.concludenode)
wrapfunction(copies, 'mergecopies', copytrace.mergecopieswithdb) if ui.configbool("copytrace", "enablecopytracing", False):
wrapfunction(copies, 'pathcopies', copytrace.pathcopieswithdb) wrapfunction(copies, 'mergecopies', copytrace.mergecopieswithdb)
wrapfunction(rebase, 'buildstate', copytrace.buildstate) wrapfunction(copies, 'pathcopies', copytrace.pathcopieswithdb)
wrapfunction(rebase, 'buildstate', copytrace.buildstate)
wrapfunction(exchange, '_pullbundle2extraprepare', if ui.configbool("copytrace", "enablebundle2", False):
bundle2._pullbundle2extraprepare) wrapfunction(exchange, '_pullbundle2extraprepare',
bundle2._pullbundle2extraprepare)

View File

@ -85,6 +85,7 @@ def concludenode(orig, repo, rev, p1, p2, **kwargs):
# this allows to trace rename information from the rebase which mercurial # this allows to trace rename information from the rebase which mercurial
# doesn't do today # doesn't do today
cp = dbutil.retrievedatapkg(repo, ['0'], move=False, askserver=False)['0'] cp = dbutil.retrievedatapkg(repo, ['0'], move=False, askserver=False)['0']
dbutil.removectx(repo, '0')
_markchanges(repo, cp) _markchanges(repo, cp)
ret = orig(repo, rev, p1, p2, **kwargs) ret = orig(repo, rev, p1, p2, **kwargs)

View File

@ -19,6 +19,7 @@ xdb = $DBNAME
xdbuser = $DBUSER xdbuser = $DBUSER
xdbpassword = $DBPASS xdbpassword = $DBPASS
xdbport = $DBPORT xdbport = $DBPORT
enablebundle2 = True
EOF EOF
} }
@ -26,5 +27,8 @@ function initclient() {
cat >> $1/.hg/hgrc <<EOF cat >> $1/.hg/hgrc <<EOF
[copytrace] [copytrace]
remote = False remote = False
enablebundle2 = True
enablefilldb = True
enablecopytracing = True
EOF EOF
} }

View File

@ -92,8 +92,6 @@ REQUESTS MISSING MOVES DURING REBASE
c c
saved backup bundle to $TESTTMP/clientrepo1/.hg/strip-backup/9c11d01510fa-7a2b0d59-backup.hg (glob) saved backup bundle to $TESTTMP/clientrepo1/.hg/strip-backup/9c11d01510fa-7a2b0d59-backup.hg (glob)
$ sqlite3 .hg/moves.db "SELECT hash, source, destination, mv FROM Moves" | sort $ sqlite3 .hg/moves.db "SELECT hash, source, destination, mv FROM Moves" | sort
0|||0
0|||1
11a19c2eb2258207a4ebaf0c7223ad340046b4c7|||0 11a19c2eb2258207a4ebaf0c7223ad340046b4c7|||0
11a19c2eb2258207a4ebaf0c7223ad340046b4c7|||1 11a19c2eb2258207a4ebaf0c7223ad340046b4c7|||1
274c7e2c58b0256e17dc0f128380c8600bb0ee43|a|b|1 274c7e2c58b0256e17dc0f128380c8600bb0ee43|a|b|1

View File

@ -1,3 +1,4 @@
$ . "$TESTDIR/copytrace.sh"
$ extpath=$(dirname $TESTDIR) $ extpath=$(dirname $TESTDIR)
$ cat >> $HGRCPATH << EOF $ cat >> $HGRCPATH << EOF
> [extensions] > [extensions]
@ -27,6 +28,7 @@ modified renamed
Setup repo Setup repo
$ hg init repo $ hg init repo
$ initclient repo
$ cd repo $ cd repo
$ echo 'foo' > a $ echo 'foo' > a
$ echo 'bar' > b $ echo 'bar' > b
@ -119,6 +121,7 @@ renamed renamed
Setup repo Setup repo
$ hg init repo $ hg init repo
$ initclient repo
$ cd repo $ cd repo
$ echo 'foo' > a $ echo 'foo' > a
$ echo 'bar' > b $ echo 'bar' > b
@ -186,6 +189,7 @@ Branch rebase
Setup repo Setup repo
$ hg init repo $ hg init repo
$ initclient repo
$ cd repo $ cd repo
$ echo 'foo' > a $ echo 'foo' > a
$ echo 'bar' > b $ echo 'bar' > b
@ -251,6 +255,8 @@ Rebase
b b
R b R b
$ cd ..
$ rm -rf repo
FOURTH TEST FOURTH TEST
@ -270,6 +276,7 @@ Branch rebase
Setup repo Setup repo
$ hg init repo $ hg init repo
$ initclient repo
$ cd repo $ cd repo
$ echo 'foo' > a $ echo 'foo' > a
$ echo 'bar' > b $ echo 'bar' > b
@ -301,7 +308,7 @@ Rebase
$ hg rebase -s 153612 -d 924ff7 $ hg rebase -s 153612 -d 924ff7
rebasing 3:153612db400b "mv d e" rebasing 3:153612db400b "mv d e"
rebasing 4:387c04c77e69 "mv e f" (tip) rebasing 4:387c04c77e69 "mv e f" (tip)
saved backup bundle to $TESTTMP/repo/repo/.hg/strip-backup/153612db400b-1ca39551-backup.hg (glob) saved backup bundle to $TESTTMP/repo/.hg/strip-backup/153612db400b-1ca39551-backup.hg (glob)
$ hg log -G -T 'changeset: {node}\n desc: {desc}\n' $ hg log -G -T 'changeset: {node}\n desc: {desc}\n'
@ changeset: b819c5a5ef7911dc41b3d9f866656f61b189ffcf @ changeset: b819c5a5ef7911dc41b3d9f866656f61b189ffcf
| desc: mv e f | desc: mv e f

View File

@ -1,3 +1,4 @@
$ . "$TESTDIR/copytrace.sh"
$ extpath=$(dirname $TESTDIR) $ extpath=$(dirname $TESTDIR)
$ cat >> $HGRCPATH << EOF $ cat >> $HGRCPATH << EOF
> [extensions] > [extensions]
@ -9,6 +10,7 @@
Setup repo Setup repo
$ hg init repo $ hg init repo
$ initclient repo
$ cd repo $ cd repo
$ touch a $ touch a
$ hg add a $ hg add a
@ -69,7 +71,9 @@ Amend wrapping
$ cd .. $ cd ..
$ rm -rf repo $ rm -rf repo
$ hg init repo $ hg init repo
$ initclient repo
$ cd repo $ cd repo
$ touch a $ touch a
$ touch b $ touch b
@ -108,9 +112,6 @@ Rebase wrapping
$ sqlite3 .hg/moves.db "SELECT hash, source, destination, mv FROM Moves" | sort $ sqlite3 .hg/moves.db "SELECT hash, source, destination, mv FROM Moves" | sort
01cdd63d5282e9d0c3267de46b9f95f06786f454|b|d|1 01cdd63d5282e9d0c3267de46b9f95f06786f454|b|d|1
01cdd63d5282e9d0c3267de46b9f95f06786f454|||0 01cdd63d5282e9d0c3267de46b9f95f06786f454|||0
0|a|c|0
0|b|d|0
0|||1
111a6d6f8ddc7309891f6e7ede7ba993125c4b54|b|d|1 111a6d6f8ddc7309891f6e7ede7ba993125c4b54|b|d|1
111a6d6f8ddc7309891f6e7ede7ba993125c4b54|||0 111a6d6f8ddc7309891f6e7ede7ba993125c4b54|||0
2f1222a290f07a1758cc927c57cc22805d6696ed|||0 2f1222a290f07a1758cc927c57cc22805d6696ed|||0