##// END OF EJS Templates
paths: add a `*` special path to define default sub option...
marmoute -
r47455:e3f15c55 default
parent child Browse files
Show More
@@ -2190,12 +2190,16 b' class paths(dict):'
2190 def __init__(self, ui):
2190 def __init__(self, ui):
2191 dict.__init__(self)
2191 dict.__init__(self)
2192
2192
2193 _path, base_sub_options = ui.configsuboptions(b'paths', b'*')
2193 for name, loc in ui.configitems(b'paths', ignoresub=True):
2194 for name, loc in ui.configitems(b'paths', ignoresub=True):
2194 # No location is the same as not existing.
2195 # No location is the same as not existing.
2195 if not loc:
2196 if not loc:
2196 continue
2197 continue
2197 loc, sub = ui.configsuboptions(b'paths', name)
2198 loc, sub = ui.configsuboptions(b'paths', name)
2198 self[name] = path(ui, name, rawloc=loc, suboptions=sub)
2199 sub_opts = base_sub_options.copy()
2200 sub_opts.update(sub)
2201 self[name] = path(ui, name, rawloc=loc, suboptions=sub_opts)
2202 self._default_sub_opts = base_sub_options
2199
2203
2200 def getpath(self, ui, name, default=None):
2204 def getpath(self, ui, name, default=None):
2201 """Return a ``path`` from a string, falling back to default.
2205 """Return a ``path`` from a string, falling back to default.
@@ -2230,7 +2234,9 b' class paths(dict):'
2230 # Try to resolve as a local path or URI.
2234 # Try to resolve as a local path or URI.
2231 try:
2235 try:
2232 # we pass the ui instance are warning might need to be issued
2236 # we pass the ui instance are warning might need to be issued
2233 return path(ui, None, rawloc=name)
2237 return path(
2238 ui, None, rawloc=name, suboptions=self._default_sub_opts
2239 )
2234 except ValueError:
2240 except ValueError:
2235 raise error.RepoError(_(b'repository %s does not exist') % name)
2241 raise error.RepoError(_(b'repository %s does not exist') % name)
2236
2242
@@ -146,4 +146,40 b' Invalid :pushrev raises appropriately'
146 ^ here)
146 ^ here)
147 [10]
147 [10]
148
148
149 default :pushrev is taking in account
150
151 $ echo babar > foo
152 $ hg ci -m 'extra commit'
153 $ hg up '.^'
154 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
155 $ echo celeste > foo
156 $ hg ci -m 'extra other commit'
157 created new head
158 $ cat >> .hg/hgrc << EOF
159 > [paths]
160 > other = file://$WD/../pushurldest
161 > *:pushrev = .
162 > EOF
163 $ hg push other
164 pushing to file:/*/$TESTTMP/pushurlsource/../pushurldest (glob)
165 searching for changes
166 adding changesets
167 adding manifests
168 adding file changes
169 added 1 changesets with 1 changes to 1 files
170 $ hg push file://$WD/../pushurldest
171 pushing to file:/*/$TESTTMP/pushurlsource/../pushurldest (glob)
172 searching for changes
173 no changes found
174 [1]
175
176 for comparison, pushing everything would give different result
177
178 $ hg push file://$WD/../pushurldest --rev 'all()'
179 pushing to file:/*/$TESTTMP/pushurlsource/../pushurldest (glob)
180 searching for changes
181 abort: push creates new remote head 1616ce7cecc8
182 (merge or see 'hg help push' for details about pushing new heads)
183 [20]
184
149 $ cd ..
185 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now