comparison mercurial/commands.py @ 11276:f28b58e35768

revset: add a debugrevspec command
author Matt Mackall <mpm@selenic.com>
date Tue, 01 Jun 2010 11:18:57 -0500
parents d1908cb95a82
children d320e70442a5
comparison
equal deleted inserted replaced
11275:c9ce8ecd6ca1 11276:f28b58e35768
11 import os, re, sys, difflib, time, tempfile 11 import os, re, sys, difflib, time, tempfile
12 import hg, util, revlog, bundlerepo, extensions, copies, error 12 import hg, util, revlog, bundlerepo, extensions, copies, error
13 import patch, help, mdiff, url, encoding, templatekw 13 import patch, help, mdiff, url, encoding, templatekw
14 import archival, changegroup, cmdutil, sshserver, hbisect, hgweb, hgweb.server 14 import archival, changegroup, cmdutil, sshserver, hbisect, hgweb, hgweb.server
15 import merge as mergemod 15 import merge as mergemod
16 import minirst 16 import minirst, revset
17 17
18 # Commands start here, listed alphabetically 18 # Commands start here, listed alphabetically
19 19
20 def add(ui, repo, *pats, **opts): 20 def add(ui, repo, *pats, **opts):
21 """add the specified files on the next commit 21 """add the specified files on the next commit
933 ui.write(value, '\n') 933 ui.write(value, '\n')
934 else: 934 else:
935 ui.debug('%s: ' % 935 ui.debug('%s: ' %
936 ui.configsource(section, name, untrusted)) 936 ui.configsource(section, name, untrusted))
937 ui.write('%s=%s\n' % (sectname, value)) 937 ui.write('%s=%s\n' % (sectname, value))
938
939 def debugrevspec(ui, repo, expr):
940 '''parse and apply a revision specification'''
941 if ui.verbose:
942 tree = revset.parse(expr)
943 ui.note(tree, "\n")
944 func = revset.match(expr)
945 for c in func(repo, range(len(repo))):
946 ui.write("%s\n" % c)
938 947
939 def debugsetparents(ui, repo, rev1, rev2=None): 948 def debugsetparents(ui, repo, rev1, rev2=None):
940 """manually set the parents of the current working directory 949 """manually set the parents of the current working directory
941 950
942 This is useful for writing repository conversion tools, but should 951 This is useful for writing repository conversion tools, but should
3780 _('[-r REV] [REV]')), 3789 _('[-r REV] [REV]')),
3781 "debugrename": 3790 "debugrename":
3782 (debugrename, 3791 (debugrename,
3783 [('r', 'rev', '', _('revision to debug'))], 3792 [('r', 'rev', '', _('revision to debug'))],
3784 _('[-r REV] FILE')), 3793 _('[-r REV] FILE')),
3794 "debugrevspec":
3795 (debugrevspec, [], ('REVSPEC')),
3785 "debugsetparents": 3796 "debugsetparents":
3786 (debugsetparents, [], _('REV1 [REV2]')), 3797 (debugsetparents, [], _('REV1 [REV2]')),
3787 "debugstate": 3798 "debugstate":
3788 (debugstate, 3799 (debugstate,
3789 [('', 'nodates', None, _('do not display the saved mtime'))], 3800 [('', 'nodates', None, _('do not display the saved mtime'))],