Subrepo support
authorPaul Crowley <paul@lshift.net>
Fri, 17 Dec 2010 20:45:16 +0000
changeset 275 2e781d52f76e
parent 274 ec60311ce2a6
child 276 cc3dd97f7300
Subrepo support
NEWS
dev/chroot-test/action/test1
dev/chroot-test/action/test2
src/hg-ssh
--- a/NEWS	Fri Dec 17 18:54:38 2010 +0000
+++ b/NEWS	Fri Dec 17 20:45:16 2010 +0000
@@ -2,6 +2,7 @@
 mercurial-server 1.1
 ======================
 
+* Allow subrepo creation
 * New log filename
 * Changed logging format to use JSON/YAML
 * Add the source IP address and other info in the SSH_CONNECTION environment variable
--- a/dev/chroot-test/action/test1	Fri Dec 17 18:54:38 2010 +0000
+++ b/dev/chroot-test/action/test1	Fri Dec 17 20:45:16 2010 +0000
@@ -28,14 +28,19 @@
 echo "Push"
 hg push
 cd ..
-mkdir realrepo
+hg init realrepo
 cd realrepo
-hg init .
 mkdir denied
 echo "This is a file" > content
 echo "This is a file not everyone can write to" > denied/cantwrite
-hg add content denied/cantwrite
+hg init nested
+echo "This is a file in a nested repo" > nested/content
+hg add -R nested nested/content
+hg commit -u test1 -R nested -m "Add files to the subrepo"
+echo "nested = nested" > .hgsub
+hg add content denied/cantwrite .hgsub
 hg commit -u test1 -m "Add files to the repo"
 echo "Pushing changes"
 hg clone . ssh://chroothg/real/project
+hg clone nested ssh://chroothg/real/project/nested
 echo "Done for user test1"
--- a/dev/chroot-test/action/test2	Fri Dec 17 18:54:38 2010 +0000
+++ b/dev/chroot-test/action/test2	Fri Dec 17 20:45:16 2010 +0000
@@ -14,6 +14,7 @@
 echo "Pulling real project"
 hg clone ssh://chroothg/real/project
 cd project
+[ -e nested/content ]
 echo "and I'm adding something" >> content
 hg commit -u test2 -m "Added something to the file"
 echo "This push should succeed"
--- a/src/hg-ssh	Fri Dec 17 18:54:38 2010 +0000
+++ b/src/hg-ssh	Fri Dec 17 20:45:16 2010 +0000
@@ -34,17 +34,8 @@
     if head:
         checkDots(head)
 
-def checkParents(path):
-    path = os.path.dirname(path)
-    if path == "":
-        return
-    if os.path.exists(path + "/.hg"):
-        fail("Cannot create repo under existing repo")
-    checkParents(path)
-
 def getrepo(op, repo):
     # First canonicalise, then check the string, then the rules
-    # and finally the filesystem.
     repo = repo.strip().rstrip("/")
     if len(repo) == 0:
         fail("path to repository seems to be empty")
@@ -54,7 +45,6 @@
     ruleset.rules.set(repo=repo)
     if not ruleset.rules.allow(op, branch=None, file=None):
         fail("access denied")
-    checkParents(repo)
     return repo
 
 config.initExe()