allow to specify bundle type

Peter Meerwald pmeerw at cosy.sbg.ac.at
Wed Apr 23 04:18:04 CDT 2008


> Don't take me wrong, but in the output you sent, there are lot of "abort" 
> showing that the second part of your testsuite is not doing what you intended 
> it to do ...

> Actually, there is a typo in the testsuite, the variable $i is used without 
> being initialised ... I guess you meant $t ... (in `hg bundle -t $i ../b$t 
> ../t$t`), thus shifting the parameters, and then taking ../b$t as type and 
> ../t$t as bundle name producing the weird output.

2nd try;
the patch now also includes gzip support by changing bundlerepo.py 
(just duplicating the bzip2 code there, however, changegroup.unbundle() 
seems to do a very similar thing)

the test script now also checks that the bundle really has the type we 
specified (by using 'head -c 6 bundle', hope this is portable enough)

thanks for review

regards, p.

-- 

Peter Meerwald
Kaigasse 3 / 8
A-5020 Salzburg / AUSTRIA
+43-664-2444418 (mobile)
-------------- next part --------------
updating working directory
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
summary:     bla
searching for changes
1 changesets found
HG10BZ
pulling from ../bdef
requesting all changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
(run 'hg update' to get a working copy)
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
summary:     bla
HG10BZ
searching for changes
1 changesets found
HG10BZ
pulling from ../bHG10BZ
requesting all changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
(run 'hg update' to get a working copy)
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
blablablablabla
summary:     bla
HG10GZ
searching for changes
1 changesets found
HG10GZ
pulling from ../bHG10GZ
requesting all changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
(run 'hg update' to get a working copy)
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
blablablablabla
summary:     bla
HG10UN
searching for changes
1 changesets found
HG10UN
pulling from ../bHG10UN
requesting all changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
(run 'hg update' to get a working copy)
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
blablablablabla
summary:     bla
abort: ../bgarbage: not a Mercurial bundle file
1 changesets found
abort: unknown bundle type specified with --type
-------------- next part --------------
#!/bin/sh

# bundle w/o type option
mkdir t1
cd t1
hg init

cd ..
hg clone t1 t2

cd t1
echo blablablablabla > file.txt
hg add file.txt
hg commit -m "bla"
hg log | grep summary
hg bundle ../bdef ../t2
head -c 6 ../bdef
echo

cd ../t2
hg pull ../bdef
hg up
hg log | grep summary
cd ..

# now test all known bundle types
for t in "HG10BZ" "HG10GZ" "HG10UN"; do
  echo $t
  hg init t$t
  cd t1
  hg bundle -t $t ../b$t ../t$t
  head -c 6 ../b$t
  echo
  cd ../t$t
  hg pull ../b$t
  hg up
  cat file.txt
  hg log | grep summary
  cd ..
done

# test garbage file
echo garbage > bgarbage
hg init tgarbage
cd tgarbage
hg pull ../bgarbage
cd ..

# test invalid bundle type
cd t1
hg bundle -a -t garbage ../bgarbage
cd ..
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: add-bundletype-support.txt
Url: http://selenic.com/pipermail/mercurial-devel/attachments/20080423/f795a3a5/attachment.txt 


More information about the Mercurial-devel mailing list