annotate contrib/casesmash.py @ 23183:51c9196a6bd0

largefiles: remove meaningless code path for "hg pull --rebase" This patch removes "--rebase" specific code path for "hg pull" in "overridepull", because previous patch makes it meaningless: now, "rebase.rebase" ("orig" invocation in this patch) can update/commit largefiles safely without "repo._isrebasing = True". As a side effect of removing "rebase.rebase" invocation in "overridepull", this patch removes "nothing to rebase ..." message in "test-largefiles.t", which is shown only when rebase extension is enabled AFTER largefiles: before this patch: 1. "dispatch" invokes "pullrebase" of rebase as "hg pull" at first, because rebase wraps "hg pull" later 2. "pullrebase" invokes "overridepull" of largefiles as "orig", even though rebase assumes that "orig" is "pull" of commands 3. "overridepull" executes "pull" and "rebase" directly 3.1 "pull" pulls changesets and creates new head "X" 3.2 "rebase" rebases current working parent "Y" on "X" 4. "overridepull" returns to "pullrebase" 5. "pullrebase" tries to rebase, but there is nothing to be done, because "Y" is already rebased on "X". then, it shows "nothing to rebase ..." after this patch: 1. "dispatch" invokes "pullrebase" of rebase as "hg pull" 2. "pullrebase" invokes "overridepull" of largefiles as "orig" 3. "overridepull" executes "pull" as "orig" 4. "overridepull" returns to "pullrebase" 5. revision "Y" is not yet rebased, so "pullrebase" doesn't shows "nothing to rebase ..." As another side effect of removing "rebase.rebase" invocation, this patch fixes issue3861, which occurs only when rebase extension is enabled BEFORE largefiles: before this patch: 1. "dispatch" invokes "overridepull" of largefiles at first, because largefiles wrap "hg pull" later 2. "overridepull" executes "pull" and "rebase" explicitly 2.1 "pull" pulls changesets and creates new head "X" 2.2 "rebase" rebases current working parent, but fails because no revision is checked out in issue3861 case 3. "overridepull" returns to "dispatch" with exit code 1 returned from "rebase" at (2.2) 4. "hg pull" terminates with exit code 1 unexpectedly after this patch: 1. "dispatch" invokes "overridepull" of largefiles at first 2. "overridepull" invokes "pullrebase" of rebase as "orig" 3. "pullrebase" invokes "pull" as "orig" 4. "pullrebase" invokes "rebase", and it fails 5. "pullrebase" returns to "overridepull" with exit code 0 (because "pullrebase" ignores result of "pull" and "rebase") 6. "overridepull" returns to "dispatch" with exit code 0 returned from "rebase" at (5) 7. "hg pull" terminates with exit code 0
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Wed, 05 Nov 2014 23:24:47 +0900
parents 9de689d20230
children 42a7301fb4d5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19322
ff1586a3adc5 cleanup: remove unused imports
Simon Heimberg <simohe@besonet.ch>
parents: 14730
diff changeset
1 import os, __builtin__
14730
f5765353d430 merge with stable
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
2 from mercurial import util
f5765353d430 merge with stable
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
3
f5765353d430 merge with stable
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
4 def lowerwrap(scope, funcname):
f5765353d430 merge with stable
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
5 f = getattr(scope, funcname)
f5765353d430 merge with stable
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
6 def wrap(fname, *args, **kwargs):
f5765353d430 merge with stable
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
7 d, base = os.path.split(fname)
f5765353d430 merge with stable
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
8 try:
f5765353d430 merge with stable
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
9 files = os.listdir(d or '.')
19378
9de689d20230 cleanup: drop unused variables and an unused import
Simon Heimberg <simohe@besonet.ch>
parents: 19322
diff changeset
10 except OSError:
14730
f5765353d430 merge with stable
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
11 files = []
f5765353d430 merge with stable
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
12 if base in files:
f5765353d430 merge with stable
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
13 return f(fname, *args, **kwargs)
f5765353d430 merge with stable
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
14 for fn in files:
f5765353d430 merge with stable
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
15 if fn.lower() == base.lower():
f5765353d430 merge with stable
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
16 return f(os.path.join(d, fn), *args, **kwargs)
f5765353d430 merge with stable
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
17 return f(fname, *args, **kwargs)
f5765353d430 merge with stable
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
18 scope.__dict__[funcname] = wrap
f5765353d430 merge with stable
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
19
f5765353d430 merge with stable
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
20 def normcase(path):
f5765353d430 merge with stable
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
21 return path.lower()
f5765353d430 merge with stable
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
22
f5765353d430 merge with stable
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
23 os.path.normcase = normcase
f5765353d430 merge with stable
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
24
f5765353d430 merge with stable
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
25 for f in 'file open'.split():
f5765353d430 merge with stable
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
26 lowerwrap(__builtin__, f)
f5765353d430 merge with stable
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
27
f5765353d430 merge with stable
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
28 for f in "chmod chown open lstat stat remove unlink".split():
f5765353d430 merge with stable
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
29 lowerwrap(os, f)
f5765353d430 merge with stable
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
30
f5765353d430 merge with stable
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
31 for f in "exists lexists".split():
f5765353d430 merge with stable
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
32 lowerwrap(os.path, f)
f5765353d430 merge with stable
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
33
f5765353d430 merge with stable
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
34 lowerwrap(util, 'posixfile')