git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/4] Better error message when renaming patches to same name

From
CLChuck Lever <cel@netapp.com>
Date
Nov 14, 2005, 16:50 UTC
Message-ID
<20051114165055.22202.28533.stgit@dexter.citi.umich.edu>
In-Reply-To
<20051114165007.22202.69803.stgit@dexter.citi.umich.edu>

Generate a more precise error message when trying to rename a patch to the same name. This is what we get currently:

  [cel@dexter main]$ stg rename nfs_direct_wait nfs_direct_wait
  Renaming patch "nfs_direct_wait" -> "nfs_direct_wait"...stg rename: Patch
  "nfs_direct_wait" already exists
  [cel@dexter main]$
Signed-off-by: Chuck Lever <cel@netapp.com>
---
 stgit/stack.py |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/stgit/stack.py b/stgit/stack.py
index 1ffeaee..0907b37 100644
--- a/stgit/stack.py
+++ b/stgit/stack.py
@@ -775,6 +775,9 @@ class Series:
         applied = self.get_applied()
         unapplied = self.get_unapplied()
 
+        if oldname == newname:
+            raise StackException, '"To" name and "from" name are the same'
+
         if newname in applied or newname in unapplied:
             raise StackException, 'Patch "%s" already exists' % newname
 
Previous: Chuck LeverNext: Chuck Lever
Message 2 of 5 in “StGIT minor clean ups”
  1. 0/4 StGIT minor clean upsChuck Lever, Nov 14, 2005
  2. 1/4 Better error message when renaming patches to same nameChuck Lever, Nov 14, 2005
  3. 2/4 use "crt_series.get_branch()" instead of "git.get_head_file()"Chuck Lever, Nov 14, 2005
  4. 3/4 Fix a typo in "stg pick"Chuck Lever, Nov 14, 2005
  5. 4/4 Fix a typo in the "add" command's documentationChuck Lever, Nov 14, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.