do not pretend to lock static-http repositories

Martin Geisler mg at daimi.au.dk
Wed Aug 20 18:02:42 UTC 2008


Dirkjan Ochtman <dirkjan at ochtman.nl> writes:

> Martin Geisler <mg <at> daimi.au.dk> writes:
>> This comes up when trying to push to a static-http repository.
>> 
>> I would have liked an error message like "cannot push to a static-http
>> repository" or something similar, but I don't see where to intercept
>> the push before it attempts to take the lock.
>
> Hmm. The lock thing seems nice (although intercepting push would be
> better), but maybe you can write a test that shows how push to
> statichttp behaves?

Sure, good idea. Here is an updated patch which includes a test:

# HG changeset patch
# User Martin Geisler <mg at daimi.au.dk>
# Date 1219255235 -7200
# Node ID 033ccd60b0f8391cb43516585d488148361e8fab
# Parent  2cb708e25a5d87d6fd71ae32ea69c37130f5b690
do not pretend to lock static-http repositories

diff -r 2cb708e25a5d -r 033ccd60b0f8 mercurial/statichttprepo.py
--- a/mercurial/statichttprepo.py	Wed Aug 20 19:00:39 2008 +0200
+++ b/mercurial/statichttprepo.py	Wed Aug 20 20:00:35 2008 +0200
@@ -72,6 +72,9 @@
     def local(self):
         return False
 
+    def lock(self, wait=True):
+        raise util.Abort(_('cannot lock static-http repository'))
+
 def instance(ui, path, create):
     if create:
         raise util.Abort(_('cannot create new static-http repository'))
diff -r 2cb708e25a5d -r 033ccd60b0f8 tests/test-static-http
--- a/tests/test-static-http	Wed Aug 20 19:00:39 2008 +0200
+++ b/tests/test-static-http	Wed Aug 20 20:00:35 2008 +0200
@@ -49,6 +49,12 @@
 echo 'changegroup = python ../printenv.py changegroup' >> .hg/hgrc
 http_proxy= hg pull | sed -e 's,:[0-9][0-9]*/,/,'
 
+echo '% trying to push'
+hg update
+echo more foo >> bar
+hg commit -m"test" -d "100000000 0"
+http_proxy= hg push
+
 echo '% test with "/" URI (issue 747)'
 cd ..
 hg init
diff -r 2cb708e25a5d -r 033ccd60b0f8 tests/test-static-http.out
--- a/tests/test-static-http.out	Wed Aug 20 19:00:39 2008 +0200
+++ b/tests/test-static-http.out	Wed Aug 20 20:00:35 2008 +0200
@@ -29,6 +29,10 @@
 adding file changes
 added 1 changesets with 1 changes to 1 files
 (run 'hg update' to get a working copy)
+% trying to push
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+pushing to static-http://localhost:20059/remote
+abort: cannot lock static-http repository
 % test with "/" URI (issue 747)
 requesting all changes
 adding changesets


-- 
Martin Geisler

VIFF (Virtual Ideal Functionality Framework) brings easy and efficient
SMPC (Secure Multi-Party Computation) to Python. See: http://viff.dk/.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-devel/attachments/20080820/9b05e5d8/attachment.asc>


More information about the Mercurial-devel mailing list