29 if p == oldp: |
29 if p == oldp: |
30 raise repo.RepoError(_("There is no Mercurial repository" |
30 raise repo.RepoError(_("There is no Mercurial repository" |
31 " here (.hg not found)")) |
31 " here (.hg not found)")) |
32 path = p |
32 path = p |
33 self.path = os.path.join(path, ".hg") |
33 self.path = os.path.join(path, ".hg") |
|
34 self.spath = self.path |
34 |
35 |
35 if not os.path.isdir(self.path): |
36 if not os.path.isdir(self.path): |
36 if create: |
37 if create: |
37 if not os.path.exists(path): |
38 if not os.path.exists(path): |
38 os.mkdir(path) |
39 os.mkdir(path) |
39 os.mkdir(self.path) |
40 os.mkdir(self.path) |
|
41 if self.spath != self.path: |
|
42 os.mkdir(self.spath) |
40 else: |
43 else: |
41 raise repo.RepoError(_("repository %s not found") % path) |
44 raise repo.RepoError(_("repository %s not found") % path) |
42 elif create: |
45 elif create: |
43 raise repo.RepoError(_("repository %s already exists") % path) |
46 raise repo.RepoError(_("repository %s already exists") % path) |
44 |
47 |
45 self.root = os.path.realpath(path) |
48 self.root = os.path.realpath(path) |
46 self.origroot = path |
49 self.origroot = path |
47 self.ui = ui.ui(parentui=parentui) |
50 self.ui = ui.ui(parentui=parentui) |
48 self.opener = util.opener(self.path) |
51 self.opener = util.opener(self.path) |
49 self.sopener = util.opener(self.path) |
52 self.sopener = util.opener(self.spath) |
50 self.wopener = util.opener(self.root) |
53 self.wopener = util.opener(self.root) |
51 |
54 |
52 try: |
55 try: |
53 self.ui.readconfig(self.join("hgrc"), self.root) |
56 self.ui.readconfig(self.join("hgrc"), self.root) |
54 except IOError: |
57 except IOError: |