changeset 6526:cfeeac24fc1e

repo: add rjoin method
author Bryan O'Sullivan <bos@serpentine.com>
date Fri, 11 Apr 2008 22:19:52 -0700
parents a020247d75e5
children 4d2cd2d26a4b
files mercurial/hg.py mercurial/localrepo.py mercurial/repo.py
diffstat 3 files changed, 14 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hg.py	Fri Apr 11 22:19:51 2008 -0700
+++ b/mercurial/hg.py	Fri Apr 11 22:19:52 2008 -0700
@@ -109,7 +109,8 @@
     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 @@
 
             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:
--- a/mercurial/localrepo.py	Fri Apr 11 22:19:51 2008 -0700
+++ b/mercurial/localrepo.py	Fri Apr 11 22:19:52 2008 -0700
@@ -476,6 +476,9 @@
     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:]
--- a/mercurial/repo.py	Fri Apr 11 22:19:51 2008 -0700
+++ b/mercurial/repo.py	Fri Apr 11 22:19:52 2008 -0700
@@ -40,3 +40,9 @@
 
     def cancopy(self):
         return self.local()
+
+    def rjoin(self, path):
+        url = self.url()
+        if url.endswith('/'):
+            return url + path
+        return url + '/' + path