chiark / gitweb /
Remove the duplicate utils.strip_leading function
authorCatalin Marinas <catalin.marinas@gmail.com>
Thu, 21 Aug 2008 22:12:16 +0000 (23:12 +0100)
committerCatalin Marinas <catalin.marinas@gmail.com>
Thu, 21 Aug 2008 22:12:16 +0000 (23:12 +0100)
This function is a duplicate of utils.strip_prefix.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
stgit/lib/git.py
stgit/utils.py

index c9d01192e135941439f8680ef243b052b2ee64ee..2386e279f6defd042bb90968ff3087303eac7d5c 100644 (file)
@@ -534,7 +534,7 @@ class Repository(RunWithEnv):
     @property
     def current_branch_name(self):
         """Return the name of the current branch."""
-        return utils.strip_leading('refs/heads/', self.head_ref)
+        return utils.strip_prefix('refs/heads/', self.head_ref)
     @property
     def default_index(self):
         """An L{Index} object representing the default index file for the
index 2983ea8b0bb42ad2ba574d4b8f5e036e4b642dcb..864975d483947c377ab480048c6ba74a045b3a8d 100644 (file)
@@ -379,12 +379,6 @@ STGIT_COMMAND_ERROR = 2  # seems to be a command that failed
 STGIT_CONFLICT = 3       # merge conflict, otherwise OK
 STGIT_BUG_ERROR = 4      # a bug in StGit
 
-def strip_leading(prefix, s):
-    """Strip leading prefix from a string. Blow up if the prefix isn't
-    there."""
-    assert s.startswith(prefix)
-    return s[len(prefix):]
-
 def add_dict(d1, d2):
     """Return a new dict with the contents of both d1 and d2. In case of
     conflicting mappings, d2 takes precedence."""