equal
deleted
inserted
replaced
439 mf = ctx.manifest() |
439 mf = ctx.manifest() |
440 node = ctx.node() |
440 node = ctx.node() |
441 |
441 |
442 files = {} |
442 files = {} |
443 |
443 |
444 p = path[1:] |
444 if path and path[-1] != "/": |
445 if p and p[-1] != "/": |
445 path += "/" |
446 p += "/" |
446 l = len(path) |
447 l = len(p) |
447 abspath = "/" + path |
448 |
448 |
449 for f,n in mf.items(): |
449 for f,n in mf.items(): |
450 if f[:l] != p: |
450 if f[:l] != path: |
451 continue |
451 continue |
452 remain = f[l:] |
452 remain = f[l:] |
453 if "/" in remain: |
453 if "/" in remain: |
454 short = remain[:remain.index("/") + 1] # bleah |
454 short = remain[:remain.index("/") + 1] # bleah |
455 files[short] = (f, None) |
455 files[short] = (f, None) |
481 full, fnode = files[f] |
481 full, fnode = files[f] |
482 if fnode: |
482 if fnode: |
483 continue |
483 continue |
484 |
484 |
485 yield {"parity": self.stripes(parity), |
485 yield {"parity": self.stripes(parity), |
486 "path": os.path.join(path, f), |
486 "path": os.path.join(abspath, f), |
487 "basename": f[:-1]} |
487 "basename": f[:-1]} |
488 parity += 1 |
488 parity += 1 |
489 |
489 |
490 yield self.t("manifest", |
490 yield self.t("manifest", |
491 rev=ctx.rev(), |
491 rev=ctx.rev(), |
492 node=hex(node), |
492 node=hex(node), |
493 path=path, |
493 path=abspath, |
494 up=_up(path), |
494 up=_up(abspath), |
495 fentries=filelist, |
495 fentries=filelist, |
496 dentries=dirlist, |
496 dentries=dirlist, |
497 archives=self.archivelist(hex(node))) |
497 archives=self.archivelist(hex(node))) |
498 |
498 |
499 def tags(self): |
499 def tags(self): |
637 # add tags to things |
637 # add tags to things |
638 # tags -> list of changesets corresponding to tags |
638 # tags -> list of changesets corresponding to tags |
639 # find tag, changeset, file |
639 # find tag, changeset, file |
640 |
640 |
641 def cleanpath(self, path): |
641 def cleanpath(self, path): |
|
642 path = path.lstrip('/') |
642 return util.canonpath(self.repo.root, '', path) |
643 return util.canonpath(self.repo.root, '', path) |
643 |
644 |
644 def run(self): |
645 def run(self): |
645 if not os.environ.get('GATEWAY_INTERFACE', '').startswith("CGI/1."): |
646 if not os.environ.get('GATEWAY_INTERFACE', '').startswith("CGI/1."): |
646 raise RuntimeError("This function is only intended to be called while running as a CGI script.") |
647 raise RuntimeError("This function is only intended to be called while running as a CGI script.") |
863 |
864 |
864 def do_rev(self, req): |
865 def do_rev(self, req): |
865 self.do_changeset(req) |
866 self.do_changeset(req) |
866 |
867 |
867 def do_file(self, req): |
868 def do_file(self, req): |
868 path = req.form.get('file', [''])[0] |
869 path = self.cleanpath(req.form.get('file', [''])[0]) |
869 if path: |
870 if path: |
870 try: |
871 try: |
871 req.write(self.filerevision(self.filectx(req))) |
872 req.write(self.filerevision(self.filectx(req))) |
872 return |
873 return |
873 except hg.RepoError: |
874 except hg.RepoError: |
874 pass |
875 pass |
875 path = self.cleanpath(path) |
876 |
876 |
877 req.write(self.manifest(self.changectx(req), path)) |
877 req.write(self.manifest(self.changectx(req), '/' + path)) |
|
878 |
878 |
879 def do_diff(self, req): |
879 def do_diff(self, req): |
880 self.do_filediff(req) |
880 self.do_filediff(req) |
881 |
881 |
882 def do_changelog(self, req, shortlog = False): |
882 def do_changelog(self, req, shortlog = False): |