X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/stgit/blobdiff_plain/01f76ccd02493effc275265ddf3b3f567eedd917..e3960931aafc4841588b0a39d74dfaf768c9219b:/stgit/utils.py diff --git a/stgit/utils.py b/stgit/utils.py index ed6e43c..67431ec 100644 --- a/stgit/utils.py +++ b/stgit/utils.py @@ -109,6 +109,12 @@ def strip_prefix(prefix, string): assert string.startswith(prefix) return string[len(prefix):] +def strip_suffix(suffix, string): + """Return string, without the suffix. Blow up if string doesn't + end with suffix.""" + assert string.endswith(suffix) + return string[:-len(suffix)] + def remove_dirs(basedir, dirs): """Starting at join(basedir, dirs), remove the directory if empty, and try the same with its parent, until we find a nonempty