##// END OF EJS Templates
status: clean up all users for unknown files
Matt Mackall -
r6760:4faaa053 default
parent child Browse files
Show More
@@ -122,8 +122,7 b' def dodiff(ui, repo, diffcmd, diffopts, '
122 '''
122 '''
123 node1, node2 = cmdutil.revpair(repo, opts['rev'])
123 node1, node2 = cmdutil.revpair(repo, opts['rev'])
124 matcher = cmdutil.match(repo, pats, opts)
124 matcher = cmdutil.match(repo, pats, opts)
125 modified, added, removed, deleted, unknown = repo.status(
125 modified, added, removed = repo.status(node1, node2, matcher)[:3]
126 node1, node2, matcher)[:5]
127 if not (modified or added or removed):
126 if not (modified or added or removed):
128 return 0
127 return 0
129
128
@@ -239,7 +239,7 b' def sign(ui, repo, *revs, **opts):'
239 repo.opener("localsigs", "ab").write(sigmessage)
239 repo.opener("localsigs", "ab").write(sigmessage)
240 return
240 return
241
241
242 for x in repo.status()[:5]:
242 for x in repo.status(unknown=True)[:5]:
243 if ".hgsigs" in x and not opts["force"]:
243 if ".hgsigs" in x and not opts["force"]:
244 raise util.Abort(_("working copy of .hgsigs is changed "
244 raise util.Abort(_("working copy of .hgsigs is changed "
245 "(please commit .hgsigs manually "
245 "(please commit .hgsigs manually "
@@ -55,9 +55,7 b' def difftree(ui, repo, node1=None, node2'
55 mmap = repo[node1].manifest()
55 mmap = repo[node1].manifest()
56 mmap2 = repo[node2].manifest()
56 mmap2 = repo[node2].manifest()
57 m = cmdutil.match(repo, files)
57 m = cmdutil.match(repo, files)
58 status = repo.status(node1, node2, match=m)[:5]
58 modified, added, removed = repo.status(node1, node2, m)[:3]
59 modified, added, removed, deleted, unknown = status
60
61 empty = short(nullid)
59 empty = short(nullid)
62
60
63 for f in modified:
61 for f in modified:
@@ -253,12 +253,12 b' class kwfilelog(filelog.filelog):'
253 return t2 != text
253 return t2 != text
254 return revlog.revlog.cmp(self, node, text)
254 return revlog.revlog.cmp(self, node, text)
255
255
256 def _status(ui, repo, kwt, *pats, **opts):
256 def _status(ui, repo, kwt, unknown, *pats, **opts):
257 '''Bails out if [keyword] configuration is not active.
257 '''Bails out if [keyword] configuration is not active.
258 Returns status of working directory.'''
258 Returns status of working directory.'''
259 if kwt:
259 if kwt:
260 matcher = cmdutil.match(repo, pats, opts)
260 matcher = cmdutil.match(repo, pats, opts)
261 return repo.status(match=matcher, clean=True)
261 return repo.status(match=matcher, unknown=unknown, clean=True)
262 if ui.configitems('keyword'):
262 if ui.configitems('keyword'):
263 raise util.Abort(_('[keyword] patterns cannot match'))
263 raise util.Abort(_('[keyword] patterns cannot match'))
264 raise util.Abort(_('no [keyword] patterns configured'))
264 raise util.Abort(_('no [keyword] patterns configured'))
@@ -268,15 +268,15 b' def _kwfwrite(ui, repo, expand, *pats, *'
268 if repo.dirstate.parents()[1] != nullid:
268 if repo.dirstate.parents()[1] != nullid:
269 raise util.Abort(_('outstanding uncommitted merge'))
269 raise util.Abort(_('outstanding uncommitted merge'))
270 kwt = kwtools['templater']
270 kwt = kwtools['templater']
271 status = _status(ui, repo, kwt, *pats, **opts)
271 status = _status(ui, repo, kwt, False, *pats, **opts)
272 modified, added, removed, deleted, unknown, ignored, clean = status
272 modified, added, removed, deleted = status[:4]
273 if modified or added or removed or deleted:
273 if modified or added or removed or deleted:
274 raise util.Abort(_('outstanding uncommitted changes'))
274 raise util.Abort(_('outstanding uncommitted changes'))
275 wlock = lock = None
275 wlock = lock = None
276 try:
276 try:
277 wlock = repo.wlock()
277 wlock = repo.wlock()
278 lock = repo.lock()
278 lock = repo.lock()
279 kwt.overwrite(None, expand, clean)
279 kwt.overwrite(None, expand, status[6])
280 finally:
280 finally:
281 del wlock, lock
281 del wlock, lock
282
282
@@ -380,11 +380,9 b' def files(ui, repo, *pats, **opts):'
380 That is, files matched by [keyword] config patterns but not symlinks.
380 That is, files matched by [keyword] config patterns but not symlinks.
381 '''
381 '''
382 kwt = kwtools['templater']
382 kwt = kwtools['templater']
383 status = _status(ui, repo, kwt, *pats, **opts)
383 status = _status(ui, repo, kwt, opts.get('untracked'), *pats, **opts)
384 modified, added, removed, deleted, unknown, ignored, clean = status
384 modified, added, removed, deleted, unknown, ignored, clean = status
385 files = modified + added + clean
385 files = modified + added + clean + unknown
386 if opts.get('untracked'):
387 files += unknown
388 files.sort()
386 files.sort()
389 wctx = repo[None]
387 wctx = repo[None]
390 kwfiles = [f for f in files if kwt.iskwfile(f, wctx.flags)]
388 kwfiles = [f for f in files if kwt.iskwfile(f, wctx.flags)]
@@ -852,7 +852,7 b' class queue:'
852 self.ui.warn(_('cleaning up working directory...'))
852 self.ui.warn(_('cleaning up working directory...'))
853 node = repo.dirstate.parents()[0]
853 node = repo.dirstate.parents()[0]
854 hg.revert(repo, node, None)
854 hg.revert(repo, node, None)
855 unknown = repo.status()[4]
855 unknown = repo.status(unknown=True)[4]
856 # only remove unknown files that we know we touched or
856 # only remove unknown files that we know we touched or
857 # created while patching
857 # created while patching
858 for f in unknown:
858 for f in unknown:
@@ -933,7 +933,7 b' class queue:'
933 qp = self.qparents(repo, rev)
933 qp = self.qparents(repo, rev)
934 changes = repo.changelog.read(qp)
934 changes = repo.changelog.read(qp)
935 mmap = repo.manifest.read(changes[0])
935 mmap = repo.manifest.read(changes[0])
936 m, a, r, d, u = repo.status(qp, top)[:5]
936 m, a, r, d = repo.status(qp, top)[:4]
937 if d:
937 if d:
938 raise util.Abort("deletions found between repo revs")
938 raise util.Abort("deletions found between repo revs")
939 for f in m:
939 for f in m:
@@ -1066,11 +1066,11 b' class queue:'
1066 # patch already
1066 # patch already
1067 #
1067 #
1068 # this should really read:
1068 # this should really read:
1069 # mm, dd, aa, aa2, uu = repo.status(tip, patchparent)[:5]
1069 # mm, dd, aa, aa2 = repo.status(tip, patchparent)[:4]
1070 # but we do it backwards to take advantage of manifest/chlog
1070 # but we do it backwards to take advantage of manifest/chlog
1071 # caching against the next repo.status call
1071 # caching against the next repo.status call
1072 #
1072 #
1073 mm, aa, dd, aa2, uu = repo.status(patchparent, tip)[:5]
1073 mm, aa, dd, aa2 = repo.status(patchparent, tip)[:4]
1074 changes = repo.changelog.read(tip)
1074 changes = repo.changelog.read(tip)
1075 man = repo.manifest.read(changes[0])
1075 man = repo.manifest.read(changes[0])
1076 aaa = aa[:]
1076 aaa = aa[:]
@@ -1078,7 +1078,7 b' class queue:'
1078 match = cmdutil.matchfiles(repo, mm + aa + dd)
1078 match = cmdutil.matchfiles(repo, mm + aa + dd)
1079 else:
1079 else:
1080 match = cmdutil.matchall(repo)
1080 match = cmdutil.matchall(repo)
1081 m, a, r, d, u = repo.status(match=match)[:5]
1081 m, a, r, d = repo.status(match=match)[:4]
1082
1082
1083 # we might end up with files that were added between
1083 # we might end up with files that were added between
1084 # tip and the dirstate parent, but then changed in the
1084 # tip and the dirstate parent, but then changed in the
@@ -1111,7 +1111,7 b' class queue:'
1111 m = util.unique(mm)
1111 m = util.unique(mm)
1112 r = util.unique(dd)
1112 r = util.unique(dd)
1113 a = util.unique(aa)
1113 a = util.unique(aa)
1114 c = [filter(matchfn, l) for l in (m, a, r, [], u)]
1114 c = [filter(matchfn, l) for l in (m, a, r)]
1115 match = cmdutil.matchfiles(repo, util.unique(c[0] + c[1] + c[2]))
1115 match = cmdutil.matchfiles(repo, util.unique(c[0] + c[1] + c[2]))
1116 patch.diff(repo, patchparent, match=match,
1116 patch.diff(repo, patchparent, match=match,
1117 fp=patchf, changes=c, opts=self.diffopts())
1117 fp=patchf, changes=c, opts=self.diffopts())
@@ -405,8 +405,8 b' def dorecord(ui, repo, committer, *pats,'
405 if match.files():
405 if match.files():
406 changes = None
406 changes = None
407 else:
407 else:
408 changes = repo.status(match=match)[:5]
408 changes = repo.status(match=match)[:3]
409 modified, added, removed = changes[:3]
409 modified, added, removed = changes
410 match = cmdutil.matchfiles(repo, modified + added + removed)
410 match = cmdutil.matchfiles(repo, modified + added + removed)
411 diffopts = mdiff.diffopts(git=True, nodates=True)
411 diffopts = mdiff.diffopts(git=True, nodates=True)
412 fp = cStringIO.StringIO()
412 fp = cStringIO.StringIO()
@@ -431,7 +431,7 b' def dorecord(ui, repo, committer, *pats,'
431
431
432 if changes is None:
432 if changes is None:
433 match = cmdutil.matchfiles(repo, newfiles)
433 match = cmdutil.matchfiles(repo, newfiles)
434 changes = repo.status(match=match)[:5]
434 changes = repo.status(match=match)
435 modified = dict.fromkeys(changes[0])
435 modified = dict.fromkeys(changes[0])
436
436
437 # 2. backup changed files, so we can restore them in the end
437 # 2. backup changed files, so we can restore them in the end
@@ -1158,8 +1158,7 b' def commit(ui, repo, commitfunc, pats, o'
1158
1158
1159 m = match(repo, pats, opts)
1159 m = match(repo, pats, opts)
1160 if pats:
1160 if pats:
1161 status = repo.status(match=m)
1161 modified, added, removed = repo.status(match=m)[:3]
1162 modified, added, removed, deleted, unknown = status[:5]
1163 files = modified + added + removed
1162 files = modified + added + removed
1164 slist = None
1163 slist = None
1165 for f in m.files():
1164 for f in m.files():
@@ -2197,7 +2197,7 b' def remove(ui, repo, *pats, **opts):'
2197 raise util.Abort(_('no files specified'))
2197 raise util.Abort(_('no files specified'))
2198
2198
2199 m = cmdutil.match(repo, pats, opts)
2199 m = cmdutil.match(repo, pats, opts)
2200 mardu = map(dict.fromkeys, repo.status(match=m))[:5]
2200 mardu = map(dict.fromkeys, repo.status(match=m, unknown=True))[:5]
2201 modified, added, removed, deleted, unknown = mardu
2201 modified, added, removed, deleted, unknown = mardu
2202
2202
2203 remove, forget = [], []
2203 remove, forget = [], []
@@ -488,7 +488,7 b' class workingctx(changectx):'
488
488
489 def __getattr__(self, name):
489 def __getattr__(self, name):
490 if name == '_status':
490 if name == '_status':
491 self._status = self._repo.status()
491 self._status = self._repo.status(unknown=True)
492 return self._status
492 return self._status
493 if name == '_manifest':
493 if name == '_manifest':
494 self._buildmanifest()
494 self._buildmanifest()
@@ -972,7 +972,7 b' class localrepository(repo.repository):'
972 yield fn
972 yield fn
973
973
974 def status(self, node1=None, node2=None, match=None,
974 def status(self, node1=None, node2=None, match=None,
975 ignored=False, clean=False, unknown=True):
975 ignored=False, clean=False, unknown=False):
976 """return status of files between two nodes or node and working directory
976 """return status of files between two nodes or node and working directory
977
977
978 If node1 is None, use the first dirstate parent instead.
978 If node1 is None, use the first dirstate parent instead.
@@ -1189,8 +1189,8 b' def diff(repo, node1=None, node2=None, m'
1189 date1 = util.datestr(ctx1.date())
1189 date1 = util.datestr(ctx1.date())
1190
1190
1191 if not changes:
1191 if not changes:
1192 changes = repo.status(node1, node2, match=match)[:5]
1192 changes = repo.status(node1, node2, match=match)
1193 modified, added, removed, deleted, unknown = changes
1193 modified, added, removed = changes[:3]
1194
1194
1195 if not modified and not added and not removed:
1195 if not modified and not added and not removed:
1196 return
1196 return
General Comments 0
You need to be logged in to leave comments. Login now