X-Git-Url: https://git.distorted.org.uk/~mdw/stgit/blobdiff_plain/fcee87cf868f18a3d684c3ba71232574f92c7b11..eb026d9396af187c6a92370595e85c4e94c4db0c:/stgit/commands/common.py diff --git a/stgit/commands/common.py b/stgit/commands/common.py index 6193eb0..293bd2e 100644 --- a/stgit/commands/common.py +++ b/stgit/commands/common.py @@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """ -import sys, os +import sys, os, re from optparse import OptionParser, make_option from stgit.utils import * @@ -30,10 +30,6 @@ class CmdException(Exception): pass -# Global variables -crt_series = stack.Series() - - # Utility functions def git_id(string): """Return the GIT id @@ -112,3 +108,13 @@ def resolved_all(): for filename in conflicts: resolved(filename) os.remove(os.path.join(git.base_dir, 'conflicts')) + +def name_email(string): + """Return a tuple consisting of the name and email parsed from a + standard 'name ' string + """ + names = re.split('([^<>]*)<([^<>]*)>', string) + if len(names) != 4: + raise CmdException, 'Incorrect "name " string: %s' % string + + return tuple([names[1].strip(), names[2].strip()])