Commits

Anonymous committed 426b3d7

Normalizing repository line endings to NL from CRNL.

Comments (0)

Files changed (3)

-This repo contains some extensions I find useful for Mercurial.
-
-== checkfiles ==
-
-hg checkfiles [options]
-
-checks changed files in the working directory for tabs or trailing whitespace
-
-    - --verbose shows the location of offending characters in each line
-    - --quiet hides filenames and only reports summary information
-    - --debug shows settings and details about each file considered for checking
-
-    If problems are found, the command returns 1, otherwise 0.
-
-options:
-
- -f --fixup    fix files by replacing tabs and removing trailing whitespace
- -t --tabsize  set the tab length (default: 8 or checkfiles.tab_size)
-
-use "hg -v help checkfiles" to show global options
-
-== rebaseif ==
-
-hg rebaseif
-
-rebases if there are no file conflicts and merges otherwise.
-
-    See each command's documentation for details.
-
-options:
-
+This repo contains some extensions I find useful for Mercurial.
+
+== checkfiles ==
+
+hg checkfiles [options]
+
+checks changed files in the working directory for tabs or trailing whitespace
+
+    - --verbose shows the location of offending characters in each line
+    - --quiet hides filenames and only reports summary information
+    - --debug shows settings and details about each file considered for checking
+
+    If problems are found, the command returns 1, otherwise 0.
+
+options:
+
+ -f --fixup    fix files by replacing tabs and removing trailing whitespace
+ -t --tabsize  set the tab length (default: 8 or checkfiles.tab_size)
+
+use "hg -v help checkfiles" to show global options
+
+== rebaseif ==
+
+hg rebaseif
+
+rebases if there are no file conflicts and merges otherwise.
+
+    See each command's documentation for details.
+
+options:
+
 use "hg -v help rebaseif" to show global options
-# checkfiles.py detect and fix tabs and(or trailing whitespace in commits
-#
-# Copyright: Marcus Lindblom 2010
-# License: GPLv2+
-
-'''detects (and optionally fixes) tabs and trailing whitespace in commited files
-
-== The hooks ==
-
-check_hook: prevents commits containing tabs or trailing whitespace, without actually touching
-            any files. Use as pretxncommit locally or pretxnchangegroup on a central repo.
-
-fixup_hook: automatically fixes any problematic files before commit. Useful in pre-commit.
-             (As this hook may changes files on disc, you will need to recompile your
-             project after commiting if any files needed fixing)
-
-             If you're not confortable with this kind of magic, use the check_hook and
-             manually run the command with the --fixup option.
-
-== The command ==
-
-hg checkfiles [options]
-
-checks changed files in the working directory for tabs or trailing whitespace
-
-    - --verbose shows the location of offending characters in each line
-    - --quiet hides filenames and only reports summary information
-    - --debug shows settings and details about each file considered for checking
-
-    If problems are found, the command returns 1, otherwise 0.
-    If --fixup is given, the return value is always 0 (unless an error occurs).
-
-options:
-
- -f --fixup          fix files by replacing tabs and removing trailing whitespace
- -t --tabsize VALUE  set the tab length (default: 4)
-
-
-== Example usage ==
-
-[extensions]
-checkfiles = /path/to/checkfiles.py enable command
-
-[hooks]
-pretxnchangegroup.checkfiles = python:/path/to/checkfiles.py:check_hook
-pretxncommit.checkfiles = python:/path/to/checkfiles.py:check_hook
-pre-commit.checkfiles = python:/path/to/checkfiles.py:fixup_hook
-
-[checkfiles]
-checked_exts = .c .h .cpp .xml .cs .html .js .css .txt .py .nsi .java .aspx .asp .bat .cmd .glsl
-ignored_files = foo/contains_tabs.txt bar/contains_trailing_ws.txt
-tab_size = 4
-'''
-
-from mercurial.i18n import _
-
-class CheckFiles(object):
-    def __init__(self, ui, repo, ctx):
-        self.ctx = ctx
-        self.ui = ui
-        self.repo = repo
-
-        self.checked_exts = ui.configlist('checkfiles', 'checked_exts',
-            default='.c .h .cpp .xml .cs .html .js .css .txt .py .nsi .java .aspx .asp .bat .cmd .glsl')
-        self.ignored_files = ui.configlist('checkfiles', 'ignored_files')
-        self.tab_size = int(ui.config('checkfiles', 'tab_size', default='4'))
-
-        self.ui.debug('checkfiles: checked extensions: %s\n' % ' '.join(self.checked_exts))
-        self.ui.debug('checkfiles: ignored files: %s\n' % ' '.join(self.ignored_files))
-
-    def is_relevant(self, file):
-        if file in self.ignored_files:
-            self.ui.debug('checkfiles: ignoring %s (explicit ignore)\n' % file)
-            return False
-
-        if not any(map(lambda e:file.endswith(e), self.checked_exts)):
-            self.ui.debug('checkfiles: ignoring %s (non-checked extension)\n' % file)
-            return False
-
-        try:
-            fctx = self.ctx[file]
-        except LookupError:
-            self.ui.debug('checkfiles: skipping %s (deleted)\n' % file)
-            return False
-
-        if '\0' in fctx.data():
-            self.ui.debug('checkfiles: skipping %s (binary)\n' % file)
-            return False
-
-        return True
-
-    def check(self):
-        filecount = 0
-        probcount = 0
-        tab_indicator = '^' * self.tab_size
-
-        for file in filter(self.is_relevant, self.ctx.files()):
-            self.ui.debug('checkfiles: checking %s ...\n' % file)
-            fctx = self.ctx[file]
-            tab = False
-            ws = False
-
-            for num, line in enumerate(fctx.data().splitlines(), 1):
-                if line.isspace():
-                    ws = True
-                    probcount += 1
-                    self.ui.note('%s (%i): all whitespace\n' % (file, num))
-
-                elif line.endswith((' ', '\t')):
-                    ws = True
-                    probcount += 1
-                    self.ui.note('%s (%i): trailing whitespace\n' % (file, num))
-
-                    line = line.expandtabs(self.tab_size)
-                    non_ws_len = len(line.rstrip())
-                    line_show = ' ' * non_ws_len + '^' * (len(line) - non_ws_len)
-                    self.ui.note('  %s\n  %s\n' % (line, line_show))
-
-                elif '\t' in line:
-                    tab = True
-                    probcount += 1
-                    self.ui.note('%s (%i): tab character(s)\n' % (file, num))
-
-                    line_show = ''.join(tab_indicator if c == '\t' else ' ' for c in line)
-                    line = line.expandtabs(self.tab_size)
-                    self.ui.note('  %s\n  %s\n' % (line, line_show))
-
-            if tab or ws:
-                filecount += 1
-                self.ui.status('checkfiles: %s: %s%s\n' %
-                    (file, 'tabs ' if tab else '', 'whitespace' if ws else ''))
-            else:
-                self.ui.note('checkfiles: %s: ok\n' % file)
-
-        if filecount > 0:
-            from mercurial.node import short
-            self.ui.warn('checkfiles: %i issues(s) found in %i file(s) in %s\n' %
-                (probcount, filecount,
-                short(self.ctx.node()) if self.ctx.node() else 'working directory'))
-
-        return filecount > 0
-
-    def fixup(self):
-        import os.path
-
-        for file in filter(self.is_relevant, self.ctx.files()):
-            lines = self.ctx[file].data().splitlines()
-            if not any(line.isspace() or '\t' in line or line.endswith(' ') for line in lines):
-                self.ui.note('checkfiles: %s ok\n' % file)
-                continue
-
-            self.ui.status('checkfiles: fixing %s\n' % file)
-
-            with open(os.path.join(self.repo.root, file), 'w') as fileobj:
-                def fixline():
-                    for line in lines:
-                        yield line.rstrip().expandtabs(self.tab_size)
-                        yield '\n'
-
-                fileobj.writelines(fixline())
-
-################################################################################################
-
-def check_hook(ui, repo, hooktype, node, **kwargs):
-    '''blocks commits/changesets containing tabs or trailing whitespace'''
-
-    if hooktype == 'pretxncommit':
-        ui.status('checkfiles: checking commit for tabs or trailing whitespace...\n')
-        cf = CheckFiles(ui, repo, repo.changectx(node))
-        return cf.check()
-
-    elif hooktype == 'pretxnchangegroup':
-        from mercurial import cmdutil
-
-        ui.status('checkfiles: checking incoming changes for tabs or trailing whitespace...\n')
-        cf = CheckFiles(ui, repo, None)
-        fail = False
-
-        for rev in cmdutil.revrange(repo, ['%s::' % node]):
-            cf.ctx = repo.changectx(rev)
-            fail = cf.check() or fail
-
-        return fail
-    else:
-        from mercurial import util
-        raise util.Abort(_('checkfiles: check_hook installed as unsupported hooktype: %s') %
-                           hooktype)
-
-def fixup_hook(ui, repo, hooktype, **kwargs):
-    '''Removes tabs and/or trailing whitespace from modified files in the working directory'''
-
-    ui.note('checkfiles: removing tabs and/or trailing whitespace in changed files...\n')
-
-    cf = CheckFiles(ui, repo, repo[None])
-    cf.fixup()
-    return False
-
-def checkfiles_cmd(ui, repo, **opts):
-    '''checks changed files in the working directory for tabs or trailing whitespace
-
-    - --verbose shows the location of offending characters in each line
-    - --quiet hides filenames and only reports summary information
-    - --debug shows settings and details about each file considered for checking
-
-    If problems are found, the command returns 1, otherwise 0.
-    If --fixup is given, the return value is always 0 (unless an error occurs).
-    '''
-
-    cf = CheckFiles(ui, repo, repo[None])
-    cf.tab_size = int(opts['tabsize'])
-
-    if opts['fixup']:
-        ui.note('checkfiles: removing tabs and/or trailing whitespace in changed files...\n')
-        cf.fixup()
-        return 0
-    else:
-        ui.note('checkfiles: checking modified files for tabs or trailing whitespace...\n')
-        return cf.check()
-
-################################################################################################
-
-cmdtable = {
-    'checkfiles': (checkfiles_cmd,
-                     [('f', 'fixup', None, 'fix files by replacing tabs and removing trailing whitespace'),
-                      ('t', 'tabsize', 4, 'set the tab length')],
-                     'hg checkfiles [options]')
+# checkfiles.py detect and fix tabs and(or trailing whitespace in commits
+#
+# Copyright: Marcus Lindblom 2010
+# License: GPLv2+
+
+'''detects (and optionally fixes) tabs and trailing whitespace in commited files
+
+== The hooks ==
+
+check_hook: prevents commits containing tabs or trailing whitespace, without actually touching
+            any files. Use as pretxncommit locally or pretxnchangegroup on a central repo.
+
+fixup_hook: automatically fixes any problematic files before commit. Useful in pre-commit.
+             (As this hook may changes files on disc, you will need to recompile your
+             project after commiting if any files needed fixing)
+
+             If you're not confortable with this kind of magic, use the check_hook and
+             manually run the command with the --fixup option.
+
+== The command ==
+
+hg checkfiles [options]
+
+checks changed files in the working directory for tabs or trailing whitespace
+
+    - --verbose shows the location of offending characters in each line
+    - --quiet hides filenames and only reports summary information
+    - --debug shows settings and details about each file considered for checking
+
+    If problems are found, the command returns 1, otherwise 0.
+    If --fixup is given, the return value is always 0 (unless an error occurs).
+
+options:
+
+ -f --fixup          fix files by replacing tabs and removing trailing whitespace
+ -t --tabsize VALUE  set the tab length (default: 4)
+
+
+== Example usage ==
+
+[extensions]
+checkfiles = /path/to/checkfiles.py enable command
+
+[hooks]
+pretxnchangegroup.checkfiles = python:/path/to/checkfiles.py:check_hook
+pretxncommit.checkfiles = python:/path/to/checkfiles.py:check_hook
+pre-commit.checkfiles = python:/path/to/checkfiles.py:fixup_hook
+
+[checkfiles]
+checked_exts = .c .h .cpp .xml .cs .html .js .css .txt .py .nsi .java .aspx .asp .bat .cmd .glsl
+ignored_files = foo/contains_tabs.txt bar/contains_trailing_ws.txt
+tab_size = 4
+'''
+
+from mercurial.i18n import _
+
+class CheckFiles(object):
+    def __init__(self, ui, repo, ctx):
+        self.ctx = ctx
+        self.ui = ui
+        self.repo = repo
+
+        self.checked_exts = ui.configlist('checkfiles', 'checked_exts',
+            default='.c .h .cpp .xml .cs .html .js .css .txt .py .nsi .java .aspx .asp .bat .cmd .glsl')
+        self.ignored_files = ui.configlist('checkfiles', 'ignored_files')
+        self.tab_size = int(ui.config('checkfiles', 'tab_size', default='4'))
+
+        self.ui.debug('checkfiles: checked extensions: %s\n' % ' '.join(self.checked_exts))
+        self.ui.debug('checkfiles: ignored files: %s\n' % ' '.join(self.ignored_files))
+
+    def is_relevant(self, file):
+        if file in self.ignored_files:
+            self.ui.debug('checkfiles: ignoring %s (explicit ignore)\n' % file)
+            return False
+
+        if not any(map(lambda e:file.endswith(e), self.checked_exts)):
+            self.ui.debug('checkfiles: ignoring %s (non-checked extension)\n' % file)
+            return False
+
+        try:
+            fctx = self.ctx[file]
+        except LookupError:
+            self.ui.debug('checkfiles: skipping %s (deleted)\n' % file)
+            return False
+
+        if '\0' in fctx.data():
+            self.ui.debug('checkfiles: skipping %s (binary)\n' % file)
+            return False
+
+        return True
+
+    def check(self):
+        filecount = 0
+        probcount = 0
+        tab_indicator = '^' * self.tab_size
+
+        for file in filter(self.is_relevant, self.ctx.files()):
+            self.ui.debug('checkfiles: checking %s ...\n' % file)
+            fctx = self.ctx[file]
+            tab = False
+            ws = False
+
+            for num, line in enumerate(fctx.data().splitlines(), 1):
+                if line.isspace():
+                    ws = True
+                    probcount += 1
+                    self.ui.note('%s (%i): all whitespace\n' % (file, num))
+
+                elif line.endswith((' ', '\t')):
+                    ws = True
+                    probcount += 1
+                    self.ui.note('%s (%i): trailing whitespace\n' % (file, num))
+
+                    line = line.expandtabs(self.tab_size)
+                    non_ws_len = len(line.rstrip())
+                    line_show = ' ' * non_ws_len + '^' * (len(line) - non_ws_len)
+                    self.ui.note('  %s\n  %s\n' % (line, line_show))
+
+                elif '\t' in line:
+                    tab = True
+                    probcount += 1
+                    self.ui.note('%s (%i): tab character(s)\n' % (file, num))
+
+                    line_show = ''.join(tab_indicator if c == '\t' else ' ' for c in line)
+                    line = line.expandtabs(self.tab_size)
+                    self.ui.note('  %s\n  %s\n' % (line, line_show))
+
+            if tab or ws:
+                filecount += 1
+                self.ui.status('checkfiles: %s: %s%s\n' %
+                    (file, 'tabs ' if tab else '', 'whitespace' if ws else ''))
+            else:
+                self.ui.note('checkfiles: %s: ok\n' % file)
+
+        if filecount > 0:
+            from mercurial.node import short
+            self.ui.warn('checkfiles: %i issues(s) found in %i file(s) in %s\n' %
+                (probcount, filecount,
+                short(self.ctx.node()) if self.ctx.node() else 'working directory'))
+
+        return filecount > 0
+
+    def fixup(self):
+        import os.path
+
+        for file in filter(self.is_relevant, self.ctx.files()):
+            lines = self.ctx[file].data().splitlines()
+            if not any(line.isspace() or '\t' in line or line.endswith(' ') for line in lines):
+                self.ui.note('checkfiles: %s ok\n' % file)
+                continue
+
+            self.ui.status('checkfiles: fixing %s\n' % file)
+
+            with open(os.path.join(self.repo.root, file), 'w') as fileobj:
+                def fixline():
+                    for line in lines:
+                        yield line.rstrip().expandtabs(self.tab_size)
+                        yield '\n'
+
+                fileobj.writelines(fixline())
+
+################################################################################################
+
+def check_hook(ui, repo, hooktype, node, **kwargs):
+    '''blocks commits/changesets containing tabs or trailing whitespace'''
+
+    if hooktype == 'pretxncommit':
+        ui.status('checkfiles: checking commit for tabs or trailing whitespace...\n')
+        cf = CheckFiles(ui, repo, repo.changectx(node))
+        return cf.check()
+
+    elif hooktype == 'pretxnchangegroup':
+        from mercurial import cmdutil
+
+        ui.status('checkfiles: checking incoming changes for tabs or trailing whitespace...\n')
+        cf = CheckFiles(ui, repo, None)
+        fail = False
+
+        for rev in cmdutil.revrange(repo, ['%s::' % node]):
+            cf.ctx = repo.changectx(rev)
+            fail = cf.check() or fail
+
+        return fail
+    else:
+        from mercurial import util
+        raise util.Abort(_('checkfiles: check_hook installed as unsupported hooktype: %s') %
+                           hooktype)
+
+def fixup_hook(ui, repo, hooktype, **kwargs):
+    '''Removes tabs and/or trailing whitespace from modified files in the working directory'''
+
+    ui.note('checkfiles: removing tabs and/or trailing whitespace in changed files...\n')
+
+    cf = CheckFiles(ui, repo, repo[None])
+    cf.fixup()
+    return False
+
+def checkfiles_cmd(ui, repo, **opts):
+    '''checks changed files in the working directory for tabs or trailing whitespace
+
+    - --verbose shows the location of offending characters in each line
+    - --quiet hides filenames and only reports summary information
+    - --debug shows settings and details about each file considered for checking
+
+    If problems are found, the command returns 1, otherwise 0.
+    If --fixup is given, the return value is always 0 (unless an error occurs).
+    '''
+
+    cf = CheckFiles(ui, repo, repo[None])
+    cf.tab_size = int(opts['tabsize'])
+
+    if opts['fixup']:
+        ui.note('checkfiles: removing tabs and/or trailing whitespace in changed files...\n')
+        cf.fixup()
+        return 0
+    else:
+        ui.note('checkfiles: checking modified files for tabs or trailing whitespace...\n')
+        return cf.check()
+
+################################################################################################
+
+cmdtable = {
+    'checkfiles': (checkfiles_cmd,
+                     [('f', 'fixup', None, 'fix files by replacing tabs and removing trailing whitespace'),
+                      ('t', 'tabsize', 4, 'set the tab length')],
+                     'hg checkfiles [options]')
 }
-# Copyright: Marcus Lindblom 2010
-# License: GPLv2+
-#
-'''command that perform rebase or merge depending on the existance of merge conflicts
-
-Provides the 'rebaseif' command that rebases if there are no conflicts and merges otherwise.
-The reason for doing so is that a badly resolved conflict is easier to detect and fix afterwards
-if it was merges, since the conflict resolution is explicit in a separate commit, rather than mashed
-up with others as in the rebase case
-
-Also adds a --rebaseif option to pull, similar to --rebase.
-'''
-
-# See http://stackoverflow.com/questions/4086724/how-do-i-check-for-potential-merge-rebase-conflicts-in-mercurial
-# for some discussion on the matter
-
-from mercurial import hg, commands, extensions, cmdutil
-from mercurial.i18n import _
-
-def rebaseif(ui, repo, **opts):
-    '''rebases if there are no file conflicts and merges otherwise.
-
-    See each command's documentation for details.
-    '''
-
-    # temporarly replace merge tool to try automatic rebase
-    origmerge = ui.config('ui', 'merge')
-    ui.setconfig('ui', 'merge', 'internal:merge')
-
-    import hgext.rebase
-
-    try:
-        hgext.rebase.rebase(ui, repo)
-        ui.status(_('rebaseif: successful rebase'))
-        return 0
-    except:
-        hgext.rebase.rebase(ui, repo, abort=True)
-    finally:
-        ui.setconfig('ui', 'merge', origmerge)
-
-    ui.status(_('rebaseif: failed to rebase, attempting merge'))
-
-    import mercurial.commands
-    mercurial.commands.merge(ui, repo)
-
-    return 0
-
-
-##############################################################################################
-
-def pullrebaseif(orig, ui, repo, *args, **opts):
-    '''Call rebaseif after pull if the latter has been invoked with --rebaseif'''
-    # this function is taken in verbatim from rebase extension, with rebase replaced with rebaseif
-
-    if opts.get('rebaseif'):
-        if opts.get('update'):
-            del opts['update']
-            ui.debug(_('--update and --rebaseif are not compatible, ignoring the update flag\n'))
-
-        cmdutil.bail_if_changed(repo)
-        revsprepull = len(repo)
-        origpostincoming = commands.postincoming
-        def _dummy(*args, **kwargs):
-            pass
-        commands.postincoming = _dummy
-        try:
-            orig(ui, repo, *args, **opts)
-        finally:
-            commands.postincoming = origpostincoming
-        revspostpull = len(repo)
-        if revspostpull > revsprepull:
-            rebaseif(ui, repo, **opts)
-            branch = repo[None].branch()
-            dest = repo[branch].rev()
-            if dest != repo['.'].rev():
-                # there was nothing to rebase we force an update
-                hg.update(repo, dest)
-    else:
-        orig(ui, repo, *args, **opts)
-
-##############################################################################################
-
-def uisetup(ui):
-    '''Replaces pull with a decorator to provide --rebaseif option'''
-
-    entry = extensions.wrapcommand(commands.table, 'pull', pullrebaseif)
-    entry[1].append(('', 'rebaseif', None,
-                     _('rebase or merge working directory to branch head'))
-)
-
-##############################################################################################
-
-cmdtable = {
-    # 'command-name': (function-call, options-list, help-string)
-    'rebaseif': (rebaseif, [], 'hg rebaseif')
-}
+# Copyright: Marcus Lindblom 2010
+# License: GPLv2+
+#
+'''command that perform rebase or merge depending on the existance of merge conflicts
+
+Provides the 'rebaseif' command that rebases if there are no conflicts and merges otherwise.
+The reason for doing so is that a badly resolved conflict is easier to detect and fix afterwards
+if it was merges, since the conflict resolution is explicit in a separate commit, rather than mashed
+up with others as in the rebase case
+
+Also adds a --rebaseif option to pull, similar to --rebase.
+'''
+
+# See http://stackoverflow.com/questions/4086724/how-do-i-check-for-potential-merge-rebase-conflicts-in-mercurial
+# for some discussion on the matter
+
+from mercurial import hg, commands, extensions, cmdutil
+from mercurial.i18n import _
+
+def rebaseif(ui, repo, **opts):
+    '''rebases if there are no file conflicts and merges otherwise.
+
+    See each command's documentation for details.
+    '''
+
+    # temporarly replace merge tool to try automatic rebase
+    origmerge = ui.config('ui', 'merge')
+    ui.setconfig('ui', 'merge', 'internal:merge')
+
+    import hgext.rebase
+
+    try:
+        hgext.rebase.rebase(ui, repo)
+        ui.status(_('rebaseif: successful rebase'))
+        return 0
+    except:
+        hgext.rebase.rebase(ui, repo, abort=True)
+    finally:
+        ui.setconfig('ui', 'merge', origmerge)
+
+    ui.status(_('rebaseif: failed to rebase, attempting merge'))
+
+    import mercurial.commands
+    mercurial.commands.merge(ui, repo)
+
+    return 0
+
+
+##############################################################################################
+
+def pullrebaseif(orig, ui, repo, *args, **opts):
+    '''Call rebaseif after pull if the latter has been invoked with --rebaseif'''
+    # this function is taken in verbatim from rebase extension, with rebase replaced with rebaseif
+
+    if opts.get('rebaseif'):
+        if opts.get('update'):
+            del opts['update']
+            ui.debug(_('--update and --rebaseif are not compatible, ignoring the update flag\n'))
+
+        cmdutil.bail_if_changed(repo)
+        revsprepull = len(repo)
+        origpostincoming = commands.postincoming
+        def _dummy(*args, **kwargs):
+            pass
+        commands.postincoming = _dummy
+        try:
+            orig(ui, repo, *args, **opts)
+        finally:
+            commands.postincoming = origpostincoming
+        revspostpull = len(repo)
+        if revspostpull > revsprepull:
+            rebaseif(ui, repo, **opts)
+            branch = repo[None].branch()
+            dest = repo[branch].rev()
+            if dest != repo['.'].rev():
+                # there was nothing to rebase we force an update
+                hg.update(repo, dest)
+    else:
+        orig(ui, repo, *args, **opts)
+
+##############################################################################################
+
+def uisetup(ui):
+    '''Replaces pull with a decorator to provide --rebaseif option'''
+
+    entry = extensions.wrapcommand(commands.table, 'pull', pullrebaseif)
+    entry[1].append(('', 'rebaseif', None,
+                     _('rebase or merge working directory to branch head'))
+)
+
+##############################################################################################
+
+cmdtable = {
+    # 'command-name': (function-call, options-list, help-string)
+    'rebaseif': (rebaseif, [], 'hg rebaseif')
+}