##// END OF EJS Templates
merge: pull file copy/move out of filemerge
Matt Mackall -
r3309:e8be5942 default
parent child Browse files
Show More
@@ -10,14 +10,12 b' from i18n import gettext as _'
10 from demandload import *
10 from demandload import *
11 demandload(globals(), "errno util os tempfile")
11 demandload(globals(), "errno util os tempfile")
12
12
13 def filemerge(repo, fw, fo, fd, wctx, mctx, move):
13 def filemerge(repo, fw, fo, wctx, mctx):
14 """perform a 3-way merge in the working directory
14 """perform a 3-way merge in the working directory
15
15
16 fw = filename in the working directory and first parent
16 fw = filename in the working directory and first parent
17 fo = filename in other parent
17 fo = filename in other parent
18 fd = destination filename
19 wctx, mctx = working and merge changecontexts
18 wctx, mctx = working and merge changecontexts
20 move = whether to move or copy the file to the destination
21
19
22 TODO:
20 TODO:
23 if fw is copied in the working directory, we get confused
21 if fw is copied in the working directory, we get confused
@@ -52,13 +50,6 b' def filemerge(repo, fw, fo, fd, wctx, mc'
52 'HG_OTHER_NODE': str(mctx)})
50 'HG_OTHER_NODE': str(mctx)})
53 if r:
51 if r:
54 repo.ui.warn(_("merging %s failed!\n") % fw)
52 repo.ui.warn(_("merging %s failed!\n") % fw)
55 else:
56 if fd != fw:
57 repo.ui.debug(_("copying %s to %s\n") % (fw, fd))
58 repo.wwrite(fd, repo.wread(fw))
59 if move:
60 repo.ui.debug(_("removing %s\n") % fw)
61 os.unlink(a)
62
53
63 os.unlink(b)
54 os.unlink(b)
64 os.unlink(c)
55 os.unlink(c)
@@ -294,8 +285,16 b' def applyupdates(repo, action, wctx, mct'
294 repo.ui.status(_("merging %s and %s to %s\n") % (f, f2, fd))
285 repo.ui.status(_("merging %s and %s to %s\n") % (f, f2, fd))
295 else:
286 else:
296 repo.ui.status(_("merging %s\n") % f)
287 repo.ui.status(_("merging %s\n") % f)
297 if filemerge(repo, f, f2, fd, wctx, mctx, move):
288 if filemerge(repo, f, f2, wctx, mctx):
298 unresolved += 1
289 unresolved += 1
290 else:
291 if f != fd:
292 repo.ui.debug(_("copying %s to %s\n") % (f, fd))
293 repo.wwrite(fd, repo.wread(f))
294 if move:
295 repo.ui.debug(_("removing %s\n") % f)
296 os.unlink(repo.wjoin(f))
297
299 util.set_exec(repo.wjoin(fd), flag)
298 util.set_exec(repo.wjoin(fd), flag)
300 merged += 1
299 merged += 1
301 elif m == "g": # get
300 elif m == "g": # get
General Comments 0
You need to be logged in to leave comments. Login now