comparison mercurial/cmdutil.py @ 15214:231aac5280ba

rebase: move updatedirstate into cmdutil so it can be shared
author Matt Mackall <mpm@selenic.com>
date Sun, 09 Oct 2011 16:14:37 -0500
parents 70e11de6964d
children cd6f10dccf16
comparison
equal deleted inserted replaced
15213:15f15f3b405d 15214:231aac5280ba
6 # GNU General Public License version 2 or any later version. 6 # GNU General Public License version 2 or any later version.
7 7
8 from node import hex, nullid, nullrev, short 8 from node import hex, nullid, nullrev, short
9 from i18n import _ 9 from i18n import _
10 import os, sys, errno, re, tempfile 10 import os, sys, errno, re, tempfile
11 import util, scmutil, templater, patch, error, templatekw, revlog 11 import util, scmutil, templater, patch, error, templatekw, revlog, copies
12 import match as matchmod 12 import match as matchmod
13 import subrepo 13 import subrepo
14 14
15 def parsealiases(cmd): 15 def parsealiases(cmd):
16 return cmd.lstrip("^").split("|") 16 return cmd.lstrip("^").split("|")
1174 if not dryrun: 1174 if not dryrun:
1175 rejected = wctx.add(names, prefix) 1175 rejected = wctx.add(names, prefix)
1176 bad.extend(f for f in rejected if f in match.files()) 1176 bad.extend(f for f in rejected if f in match.files())
1177 return bad 1177 return bad
1178 1178
1179 def duplicatecopies(repo, rev, p1, p2):
1180 "Reproduce copies found in the source revision in the dirstate for grafts"
1181 # Here we simulate the copies and renames in the source changeset
1182 cop, diver = copies.copies(repo, repo[rev], repo[p1], repo[p2], True)
1183 m1 = repo[rev].manifest()
1184 m2 = repo[p1].manifest()
1185 for k, v in cop.iteritems():
1186 if k in m1:
1187 if v in m1 or v in m2:
1188 repo.dirstate.copy(v, k)
1189 if v in m2 and v not in m1 and k in m2:
1190 repo.dirstate.remove(v)
1191
1179 def commit(ui, repo, commitfunc, pats, opts): 1192 def commit(ui, repo, commitfunc, pats, opts):
1180 '''commit the specified files or all outstanding changes''' 1193 '''commit the specified files or all outstanding changes'''
1181 date = opts.get('date') 1194 date = opts.get('date')
1182 if date: 1195 if date:
1183 opts['date'] = util.parsedate(date) 1196 opts['date'] = util.parsedate(date)