mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 07:17:55 +03:00
hg: fix initial commits in treeonly repos
Summary: Previously we weren't able to commit right after creating a treeonly repository. This was caused by the code attempting to read the null tree from the store, which doesn't exist. The fix is to handle the null case and return an empty tree instead of trying to look it up in the store. We already do this in a number of other cases, so this was just a missing one. Reviewed By: singhsrb Differential Revision: D6930919 fbshipit-source-id: e227612be2640282eb997f4d563102d86f0be43a
This commit is contained in:
parent
88dccd4a14
commit
6b35de4f33
@ -475,7 +475,10 @@ class treemanifestctx(object):
|
||||
def read(self):
|
||||
if self._data is None:
|
||||
store = self._manifestlog.datastore
|
||||
self._data = cstore.treemanifest(store, self._node)
|
||||
if self._node != nullid:
|
||||
self._data = cstore.treemanifest(store, self._node)
|
||||
else:
|
||||
self._data = cstore.treemanifest(store)
|
||||
return self._data
|
||||
|
||||
def node(self):
|
||||
|
@ -51,7 +51,6 @@ Push a non-tree scratch branch from one client
|
||||
Push a tree-only scratch branch from another client
|
||||
$ hgcloneshallow ssh://user@dummy/master client1 -q --config extensions.treemanifest= --config treemanifest.treeonly=True
|
||||
1 trees fetched over * (glob)
|
||||
1 trees fetched over * (glob)
|
||||
1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob)
|
||||
$ cd client1
|
||||
$ cat >> .hg/hgrc <<EOF
|
||||
|
@ -139,7 +139,6 @@ Test pushing tree-only commit with commit hooks
|
||||
$ mkdir subdir2
|
||||
$ echo >> subdir2/z
|
||||
$ hg commit -qAm 'add subdir2/z (treeonly)' --config treemanifest.treeonly=True
|
||||
1 trees fetched over * (glob)
|
||||
$ hg push --to mybook -r .
|
||||
pushing to ssh://user@dummy/master
|
||||
searching for changes
|
||||
@ -229,7 +228,7 @@ Test fetching from the server populates the cache
|
||||
$ find ../master/.hg/cache/trees/v1/get -type f | wc -l
|
||||
\s*4 (re)
|
||||
$ find ../master/.hg/cache/trees/v1/nodeinfo -type f | wc -l
|
||||
\s*5 (re)
|
||||
\s*4 (re)
|
||||
|
||||
- Move the revlogs away to show that the cache is answering prefetches
|
||||
$ mv ../master/.hg/store/meta ../master/.hg/store/meta.bak
|
||||
@ -249,11 +248,11 @@ Test fetching from the server populates the cache
|
||||
$ find ../master/.hg/cache/trees/v1/nodeinfo -type f | xargs -n 1 -I{} cp {} {}3
|
||||
$ find ../master/.hg/cache/trees/v1/nodeinfo -type f | xargs -n 1 -I{} mv {} {}4
|
||||
$ find ../master/.hg/cache/trees/v1/nodeinfo -type f | wc -l
|
||||
\s*20 (re)
|
||||
\s*16 (re)
|
||||
$ clearcache
|
||||
$ hg status --change tip
|
||||
2 trees fetched over * (glob)
|
||||
2 trees fetched over * (glob)
|
||||
A subdir2/z
|
||||
$ find ../master/.hg/cache/trees/v1/nodeinfo -type f | wc -l
|
||||
\s*12 (re)
|
||||
\s*8 (re)
|
||||
|
@ -103,7 +103,6 @@ Make a local tree-only draft commit
|
||||
\s*4 (re)
|
||||
$ echo t >> subdir/x
|
||||
$ hg commit -qm "tree only commit"
|
||||
1 trees fetched over * (glob)
|
||||
$ hg debugdata -c 3
|
||||
7fdb5a91151d114ca83c30c5cb4a1029ef9700ef
|
||||
test
|
||||
@ -283,7 +282,6 @@ Test peer-to-peer push/pull of tree only commits
|
||||
$ clearcache
|
||||
$ hgcloneshallow ssh://user@dummy/master client2 -q --config treemanifest.treeonly=True --config extensions.treemanifest=
|
||||
2 trees fetched over * (glob)
|
||||
1 trees fetched over * (glob)
|
||||
1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob)
|
||||
$ cd client2
|
||||
$ ls_l .hg/store
|
||||
@ -323,7 +321,6 @@ Test peer-to-peer push/pull of tree only commits
|
||||
# Test pushing to a treeonly peer
|
||||
$ echo y >> y
|
||||
$ hg commit -qm "modify y"
|
||||
1 trees fetched over * (glob)
|
||||
$ hg push -f -r . ssh://user@dummy/client --debug 2>&1 | grep treegroup
|
||||
bundle2-output-part: "b2x:treegroup2" (params: 3 mandatory) streamed payload
|
||||
$ cd ../client
|
||||
@ -461,3 +458,39 @@ Switch back to hybrid mode
|
||||
added 1 changesets with 0 changes to 0 files (+1 heads)
|
||||
new changesets 4f84204095e0
|
||||
(run 'hg heads .' to see heads, 'hg merge' to merge)
|
||||
$ cd ..
|
||||
|
||||
Test creating a treeonly repo from scratch
|
||||
$ hg init treeonlyrepo
|
||||
$ cd treeonlyrepo
|
||||
$ cat >> .hg/hgrc <<EOF
|
||||
> [extensions]
|
||||
> treemanifest=
|
||||
> fastmanifest=
|
||||
>
|
||||
> [treemanifest]
|
||||
> sendtrees=True
|
||||
> treeonly=True
|
||||
>
|
||||
> [fastmanifest]
|
||||
> usetree=True
|
||||
> usecache=False
|
||||
>
|
||||
> [remotefilelog]
|
||||
> reponame=treeonlyrepo
|
||||
> EOF
|
||||
$ echo foo > a
|
||||
$ hg commit -Aqm 'add a'
|
||||
$ hg log -r . -p
|
||||
changeset: 0:f87d03aef498
|
||||
tag: tip
|
||||
user: test
|
||||
date: Thu Jan 01 00:00:00 1970 +0000
|
||||
summary: add a
|
||||
|
||||
diff -r 000000000000 -r f87d03aef498 a
|
||||
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
||||
+++ b/a Thu Jan 01 00:00:00 1970 +0000
|
||||
@@ -0,0 +1,1 @@
|
||||
+foo
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user