Show More
@@ -150,8 +150,7 b' def _runcatch(ui, args):' | |||||
150 |
|
150 | |||
151 | return -1 |
|
151 | return -1 | |
152 |
|
152 | |||
153 | def _findrepo(): |
|
153 | def _findrepo(p): | |
154 | p = os.getcwd() |
|
|||
155 | while not os.path.isdir(os.path.join(p, ".hg")): |
|
154 | while not os.path.isdir(os.path.join(p, ".hg")): | |
156 | oldp, p = p, os.path.dirname(p) |
|
155 | oldp, p = p, os.path.dirname(p) | |
157 | if p == oldp: |
|
156 | if p == oldp: | |
@@ -254,7 +253,7 b' def _dispatch(ui, args):' | |||||
254 | os.chdir(cwd[-1]) |
|
253 | os.chdir(cwd[-1]) | |
255 |
|
254 | |||
256 | # read the local repository .hgrc into a local ui object |
|
255 | # read the local repository .hgrc into a local ui object | |
257 | path = _findrepo() or "" |
|
256 | path = _findrepo(os.getcwd()) or "" | |
258 | if not path: |
|
257 | if not path: | |
259 | lui = ui |
|
258 | lui = ui | |
260 | if path: |
|
259 | if path: | |
@@ -345,6 +344,11 b' def _dispatch(ui, args):' | |||||
345 | ui.setconfig("bundle", "mainreporoot", repo.root) |
|
344 | ui.setconfig("bundle", "mainreporoot", repo.root) | |
346 | except hg.RepoError: |
|
345 | except hg.RepoError: | |
347 | if cmd not in commands.optionalrepo.split(): |
|
346 | if cmd not in commands.optionalrepo.split(): | |
|
347 | if args and not path: # try to infer -R from command args | |||
|
348 | repos = map(_findrepo, args) | |||
|
349 | guess = repos[0] | |||
|
350 | if guess and repos.count(guess) == len(repos): | |||
|
351 | return _dispatch(ui, ['--repository', guess] + fullargs) | |||
348 | if not path: |
|
352 | if not path: | |
349 | raise hg.RepoError(_("There is no Mercurial repository here" |
|
353 | raise hg.RepoError(_("There is no Mercurial repository here" | |
350 | " (.hg not found)")) |
|
354 | " (.hg not found)")) |
@@ -25,6 +25,13 b' echo %% -R/--repository' | |||||
25 | hg -R a tip |
|
25 | hg -R a tip | |
26 | hg --repository b tip |
|
26 | hg --repository b tip | |
27 |
|
27 | |||
|
28 | echo %% implicit -R | |||
|
29 | hg ann a/a | |||
|
30 | hg ann a/a a/a | |||
|
31 | hg ann a/a b/b | |||
|
32 | hg -R b ann a/a | |||
|
33 | hg log | |||
|
34 | ||||
28 | echo %% abbrev of long option |
|
35 | echo %% abbrev of long option | |
29 | hg --repo c tip |
|
36 | hg --repo c tip | |
30 |
|
37 |
@@ -24,6 +24,12 b' user: test' | |||||
24 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
24 | date: Thu Jan 01 00:00:01 1970 +0000 | |
25 | summary: b |
|
25 | summary: b | |
26 |
|
26 | |||
|
27 | %% implicit -R | |||
|
28 | 0: a | |||
|
29 | 0: a | |||
|
30 | abort: There is no Mercurial repository here (.hg not found)! | |||
|
31 | abort: a/a not under root | |||
|
32 | abort: There is no Mercurial repository here (.hg not found)! | |||
27 | %% abbrev of long option |
|
33 | %% abbrev of long option | |
28 | changeset: 1:b6c483daf290 |
|
34 | changeset: 1:b6c483daf290 | |
29 | tag: tip |
|
35 | tag: tip |
General Comments 0
You need to be logged in to leave comments.
Login now