Thread (5 messages) flat view 5 messages, 2 authors, 2016-06-15
DORMANTno replies

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

From: Chuck Lever <hidden>
Date: 2016-06-15 22:42:11
Subsystem: the rest · Maintainer: Linus Torvalds

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 <redacted>
---

 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
 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help