do not pretend to lock static-http repositories

Martin Geisler mg at daimi.au.dk
Wed Aug 20 18:29:43 UTC 2008


Martin Geisler <mg at daimi.au.dk> writes:

> 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:

Ah, I just realized why the other tests ran the output through sed...
(to strip out the $HGPORT) So this is a better patch:

# HG changeset patch
# User Martin Geisler <mg at daimi.au.dk>
# Date 1219256873 -7200
# Node ID 8a806e2146c0cce03a9340493a30e958195d2494
# Parent  41db9bfd7b6f66480fabfa1aeffcfd7d18282c65
do not pretend to lock static-http repositories

diff -r 41db9bfd7b6f -r 8a806e2146c0 mercurial/statichttprepo.py
--- a/mercurial/statichttprepo.py	Wed Aug 20 20:26:30 2008 +0200
+++ b/mercurial/statichttprepo.py	Wed Aug 20 20:27:53 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 41db9bfd7b6f -r 8a806e2146c0 tests/test-static-http
--- a/tests/test-static-http	Wed Aug 20 20:26:30 2008 +0200
+++ b/tests/test-static-http	Wed Aug 20 20:27:53 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 | sed -e 's,:[0-9][0-9]*/,/,'
+
 echo '% test with "/" URI (issue 747)'
 cd ..
 hg init
diff -r 41db9bfd7b6f -r 8a806e2146c0 tests/test-static-http.out
--- a/tests/test-static-http.out	Wed Aug 20 20:26:30 2008 +0200
+++ b/tests/test-static-http.out	Wed Aug 20 20:27:53 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
+abort: cannot lock static-http repository
+pushing to static-http://localhost/remote
 % 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/a7888006/attachment.asc>


More information about the Mercurial-devel mailing list