def commit(ui, repo, commitfunc, pats, opts): '''commit the specified files or all outstanding changes''' date = opts.get('date') if date: opts['date'] = util.parsedate(date) message = logmessage(ui, opts) # extract addremove carefully -- this function can be called from a command # that doesn't support addremove if opts.get('addremove'): scmutil.addremove(repo, pats, opts) return commitfunc(ui, repo, message, scmutil.match(repo[None], pats, opts), opts)
def walkpat(pat): srcs = [] badstates = after and '?' or '?r' m = scmutil.match(repo[None], [pat], opts, globbed=True) for abs in repo.walk(m): state = repo.dirstate[abs] rel = m.rel(abs) exact = m.exact(abs) if state in badstates: if exact and state == '?': ui.warn(_('%s: not copying - file is not managed\n') % rel) if exact and state == 'r': ui.warn(_('%s: not copying - file has been marked for' ' remove\n') % rel) continue # abs: hgsep # rel: ossep srcs.append((abs, rel, exact)) return srcs