Mercurial > public > mercurial-scm > hg-stable
diff mercurial/cmdutil.py @ 25310:c1f5ef76d1c2
record: add an operation arguments to customize recording ui
This patch is part of a series of patches to change the recording ui to reflect
the operation currently running (commit, shelve, revert ...).
This patch adds a new argument to the recording function to reflect in the UI
what operation we are running.
author | Laurent Charignon <lcharignon@fb.com> |
---|---|
date | Wed, 27 May 2015 15:49:24 -0700 |
parents | 8e0e334bad42 |
children | 31f3636e9296 |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Sun Apr 26 18:13:48 2015 +0900 +++ b/mercurial/cmdutil.py Wed May 27 15:49:24 2015 -0700 @@ -45,7 +45,7 @@ setattr(ui, 'write', wrap) return oldwrite -def filterchunks(ui, originalhunks, usecurses, testfile): +def filterchunks(ui, originalhunks, usecurses, testfile, operation=None): if usecurses: if testfile: recordfn = crecordmod.testdecorator(testfile, @@ -53,17 +53,23 @@ else: recordfn = crecordmod.chunkselector - return crecordmod.filterpatch(ui, originalhunks, recordfn) + return crecordmod.filterpatch(ui, originalhunks, recordfn, operation) else: - return patch.filterpatch(ui, originalhunks) - -def recordfilter(ui, originalhunks): + return patch.filterpatch(ui, originalhunks, operation) + +def recordfilter(ui, originalhunks, operation=None): + """ Prompts the user to filter the originalhunks and return a list of + selected hunks. + *operation* is used for ui purposes to indicate the user + what kind of filtering they are doing: reverting, commiting, shelving, etc. + """ usecurses = ui.configbool('experimental', 'crecord', False) testfile = ui.config('experimental', 'crecordtest', None) oldwrite = setupwrapcolorwrite(ui) try: - newchunks = filterchunks(ui, originalhunks, usecurses, testfile) + newchunks = filterchunks(ui, originalhunks, usecurses, testfile, + operation) finally: ui.write = oldwrite return newchunks