Mercurial > public > mercurial-scm > hg
comparison mercurial/merge.py @ 6272:dd9bd227ae9a
merge: simplify some helpers
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sat, 15 Mar 2008 10:02:31 -0500 |
parents | 01aed23355e9 |
children | 20aa460a52b6 |
comparison
equal
deleted
inserted
replaced
6271:01aed23355e9 | 6272:dd9bd227ae9a |
---|---|
9 from i18n import _ | 9 from i18n import _ |
10 import errno, util, os, heapq, filemerge | 10 import errno, util, os, heapq, filemerge |
11 | 11 |
12 def _checkunknown(wctx, mctx): | 12 def _checkunknown(wctx, mctx): |
13 "check for collisions between unknown files and files in mctx" | 13 "check for collisions between unknown files and files in mctx" |
14 man = mctx.manifest() | |
15 for f in wctx.unknown(): | 14 for f in wctx.unknown(): |
16 if f in man: | 15 if f in mctx and mctx[f].cmp(wctx[f].data()): |
17 if mctx.filectx(f).cmp(wctx.filectx(f).data()): | 16 raise util.Abort(_("untracked file in working directory differs" |
18 raise util.Abort(_("untracked file in working directory differs" | 17 " from file in requested revision: '%s'") % f) |
19 " from file in requested revision: '%s'") | |
20 % f) | |
21 | 18 |
22 def _checkcollision(mctx): | 19 def _checkcollision(mctx): |
23 "check for case folding collisions in the destination context" | 20 "check for case folding collisions in the destination context" |
24 folded = {} | 21 folded = {} |
25 for fn in mctx.manifest(): | 22 for fn in mctx: |
26 fold = fn.lower() | 23 fold = fn.lower() |
27 if fold in folded: | 24 if fold in folded: |
28 raise util.Abort(_("case-folding collision between %s and %s") | 25 raise util.Abort(_("case-folding collision between %s and %s") |
29 % (fn, folded[fold])) | 26 % (fn, folded[fold])) |
30 folded[fold] = fn | 27 folded[fold] = fn |
43 that is not present in the working directory, we need to mark it | 40 that is not present in the working directory, we need to mark it |
44 as removed. | 41 as removed. |
45 """ | 42 """ |
46 | 43 |
47 action = [] | 44 action = [] |
48 man = mctx.manifest() | |
49 state = branchmerge and 'r' or 'f' | 45 state = branchmerge and 'r' or 'f' |
50 for f in wctx.deleted(): | 46 for f in wctx.deleted(): |
51 if f not in man: | 47 if f not in mctx: |
52 action.append((f, state)) | 48 action.append((f, state)) |
53 | 49 |
54 if not branchmerge: | 50 if not branchmerge: |
55 for f in wctx.removed(): | 51 for f in wctx.removed(): |
56 if f not in man: | 52 if f not in mctx: |
57 action.append((f, "f")) | 53 action.append((f, "f")) |
58 | 54 |
59 return action | 55 return action |
60 | 56 |
61 def _nonoverlap(d1, d2, d3): | 57 def _nonoverlap(d1, d2, d3): |