Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/merge.py @ 2971:33dcf03ef45f
merge: hoist partial code out of manifest loops
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Tue, 22 Aug 2006 16:23:29 -0500 |
parents | fa9c769fee8a |
children | ad558f297eb1 |
comparison
equal
deleted
inserted
replaced
2970:fa9c769fee8a | 2971:33dcf03ef45f |
---|---|
77 linear_path = (pa == p1 or pa == p2) | 77 linear_path = (pa == p1 or pa == p2) |
78 if branchmerge and linear_path: | 78 if branchmerge and linear_path: |
79 raise util.Abort(_("there is nothing to merge, just use " | 79 raise util.Abort(_("there is nothing to merge, just use " |
80 "'hg update' or look at 'hg heads'")) | 80 "'hg update' or look at 'hg heads'")) |
81 | 81 |
82 if not overwrite and not linear_path and not branchmerge: | 82 if not linear_path and not (overwrite or branchmerge): |
83 raise util.Abort(_("update spans branches, use 'hg merge' " | 83 raise util.Abort(_("update spans branches, use 'hg merge' " |
84 "or 'hg update -C' to lose changes")) | 84 "or 'hg update -C' to lose changes")) |
85 | 85 |
86 modified, added, removed, deleted, unknown = repo.status()[:5] | 86 modified, added, removed, deleted, unknown = repo.status()[:5] |
87 if branchmerge and not forcemerge: | 87 if branchmerge and not forcemerge: |
138 # prevent the dirstate from listing the file when it is no | 138 # prevent the dirstate from listing the file when it is no |
139 # longer in the manifest. | 139 # longer in the manifest. |
140 if linear_path and f not in m2: | 140 if linear_path and f not in m2: |
141 forget.append(f) | 141 forget.append(f) |
142 | 142 |
143 if partial: | |
144 for f in mw.keys(): | |
145 if not partial(f): del mw[f] | |
146 for f in m2.keys(): | |
147 if not partial(f): del m2[f] | |
148 | |
143 # Compare manifests | 149 # Compare manifests |
144 for f, n in mw.iteritems(): | 150 for f, n in mw.iteritems(): |
145 if partial and not partial(f): | |
146 continue | |
147 if f in m2: | 151 if f in m2: |
148 queued = 0 | 152 queued = 0 |
149 | 153 |
150 # are files different? | 154 # are files different? |
151 if n != m2[f]: | 155 if n != m2[f]: |
203 repo.ui.debug(_("local modified %s, keeping\n") % f) | 207 repo.ui.debug(_("local modified %s, keeping\n") % f) |
204 else: | 208 else: |
205 repo.ui.debug(_("working dir created %s, keeping\n") % f) | 209 repo.ui.debug(_("working dir created %s, keeping\n") % f) |
206 | 210 |
207 for f, n in m2.iteritems(): | 211 for f, n in m2.iteritems(): |
208 if partial and not partial(f): | |
209 continue | |
210 if f[0] == "/": | 212 if f[0] == "/": |
211 continue | 213 continue |
212 if f in ma and n != ma[f]: | 214 if f in ma and n != ma[f]: |
213 r = _("k") | 215 r = _("k") |
214 if not overwrite: | 216 if not overwrite: |