Show More
@@ -68,16 +68,12 b' class localrepository(repo.repository):' | |||||
68 | elif create: |
|
68 | elif create: | |
69 | raise error.RepoError(_("repository %s already exists") % path) |
|
69 | raise error.RepoError(_("repository %s already exists") % path) | |
70 | else: |
|
70 | else: | |
71 | # find requirements |
|
|||
72 | requirements = set() |
|
|||
73 | try: |
|
71 | try: | |
74 |
requirements = s |
|
72 | requirements = scmutil.readrequires(self.opener, self.supported) | |
75 | except IOError, inst: |
|
73 | except IOError, inst: | |
76 | if inst.errno != errno.ENOENT: |
|
74 | if inst.errno != errno.ENOENT: | |
77 | raise |
|
75 | raise | |
78 |
|
|
76 | requirements = set() | |
79 | raise error.RequirementError( |
|
|||
80 | _("requirement '%s' not supported") % r) |
|
|||
81 |
|
77 | |||
82 | self.sharedpath = self.path |
|
78 | self.sharedpath = self.path | |
83 | try: |
|
79 | try: |
@@ -691,3 +691,13 b' def dirstatecopy(ui, repo, wctx, src, ds' | |||||
691 | wctx.add([dst]) |
|
691 | wctx.add([dst]) | |
692 | elif not dryrun: |
|
692 | elif not dryrun: | |
693 | wctx.copy(origsrc, dst) |
|
693 | wctx.copy(origsrc, dst) | |
|
694 | ||||
|
695 | def readrequires(opener, supported): | |||
|
696 | '''Reads and parses .hg/requires and checks if all entries found | |||
|
697 | are in the list of supported features.''' | |||
|
698 | requirements = set(opener.read("requires").splitlines()) | |||
|
699 | for r in requirements: | |||
|
700 | if r not in supported: | |||
|
701 | raise error.RequirementError( | |||
|
702 | _("requirement '%s' not supported") % r) | |||
|
703 | return requirements |
@@ -91,12 +91,13 b' class statichttprepository(localrepo.loc' | |||||
91 | opener = build_opener(ui, authinfo) |
|
91 | opener = build_opener(ui, authinfo) | |
92 | self.opener = opener(self.path) |
|
92 | self.opener = opener(self.path) | |
93 |
|
93 | |||
94 | # find requirements |
|
|||
95 | try: |
|
94 | try: | |
96 |
requirements = self.opener. |
|
95 | requirements = scmutil.readrequires(self.opener, self.supported) | |
97 | except IOError, inst: |
|
96 | except IOError, inst: | |
98 | if inst.errno != errno.ENOENT: |
|
97 | if inst.errno != errno.ENOENT: | |
99 | raise |
|
98 | raise | |
|
99 | requirements = set() | |||
|
100 | ||||
100 | # check if it is a non-empty old-style repository |
|
101 | # check if it is a non-empty old-style repository | |
101 | try: |
|
102 | try: | |
102 | fp = self.opener("00changelog.i") |
|
103 | fp = self.opener("00changelog.i") | |
@@ -108,13 +109,6 b' class statichttprepository(localrepo.loc' | |||||
108 | # we do not care about empty old-style repositories here |
|
109 | # we do not care about empty old-style repositories here | |
109 | msg = _("'%s' does not appear to be an hg repository") % path |
|
110 | msg = _("'%s' does not appear to be an hg repository") % path | |
110 | raise error.RepoError(msg) |
|
111 | raise error.RepoError(msg) | |
111 | requirements = [] |
|
|||
112 |
|
||||
113 | # check them |
|
|||
114 | for r in requirements: |
|
|||
115 | if r not in self.supported: |
|
|||
116 | raise error.RequirementError( |
|
|||
117 | _("requirement '%s' not supported") % r) |
|
|||
118 |
|
112 | |||
119 | # setup store |
|
113 | # setup store | |
120 | self.store = store.store(requirements, self.path, opener) |
|
114 | self.store = store.store(requirements, self.path, opener) |
General Comments 0
You need to be logged in to leave comments.
Login now