# HG changeset patch
# User Bryan O'Sullivan <bos@serpentine.com>
# Date 2008-04-12 05:19:52
# Node ID cfeeac24fc1e38fdd46063e5f92b9535455f14b1
# Parent  a020247d75e5ad770e888863189f60dc55466d05

repo: add rjoin method

diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -109,7 +109,8 @@ def clone(ui, source, dest=None, pull=Fa
     rev: revision to clone up to (implies pull=True)
 
     update: update working directory after clone completes, if
-    destination is local repository
+    destination is local repository (True means update to default rev,
+    anything else is treated as a revision)
     """
 
     if isinstance(source, str):
@@ -244,7 +245,9 @@ def clone(ui, source, dest=None, pull=Fa
 
             if update:
                 dest_repo.ui.status(_("updating working directory\n"))
-                if not checkout:
+                if update is not True:
+                    checkout = update
+                elif not checkout:
                     try:
                         checkout = dest_repo.lookup("default")
                     except:
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -476,6 +476,9 @@ class localrepository(repo.repository):
     def wjoin(self, f):
         return os.path.join(self.root, f)
 
+    def rjoin(self, f):
+        return os.path.join(self.root, util.pconvert(f))
+        
     def file(self, f):
         if f[0] == '/':
             f = f[1:]
diff --git a/mercurial/repo.py b/mercurial/repo.py
--- a/mercurial/repo.py
+++ b/mercurial/repo.py
@@ -40,3 +40,9 @@ class repository(object):
 
     def cancopy(self):
         return self.local()
+
+    def rjoin(self, path):
+        url = self.url()
+        if url.endswith('/'):
+            return url + path
+        return url + '/' + path