From 809078571610ad9382dd69f30947b5b0c897a9b5 Mon Sep 17 00:00:00 2001
From: david-sarah <david-sarah@jacaranda.org>
Date: Sat, 17 Jul 2010 15:04:11 -0700
Subject: [PATCH] CLI: add 'tahoe unlink' as an alias to 'tahoe rm', for
 forward-compatibility.

---
 CREDITS                        | 2 +-
 NEWS                           | 2 ++
 src/allmydata/scripts/cli.py   | 2 ++
 src/allmydata/test/test_cli.py | 6 ++++++
 4 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/CREDITS b/CREDITS
index 2f298e35..9da28074 100644
--- a/CREDITS
+++ b/CREDITS
@@ -99,7 +99,7 @@ D: edited docs/running.html
 N: David-Sarah Hopwood
 E: david-sarah@jacaranda.org
 P: 12F8 A95C C90B B68E 369C 003D 5947 3C63 3CB3 A807
-D: Tahoe-LAFS Hacker; ticket gardening, code, code review, docs, SFTP frontend
+D: Tahoe-LAFS Hacker; ticket gardening, code, code review, docs, SFTP, cli
 
 N: Jacob Appelbaum
 E: jacob@appelbaum.com
diff --git a/NEWS b/NEWS
index 3110d783..53771941 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,8 @@
  - Fix minor layout issue in the Web User Interface with Internet Explorer
    (#1097)
  - Fix bug where server version number was always 0 on the welcome page (#1067)
+ - Add new command-line command "tahoe unlink" as a synonym for "tahoe rm"
+   (#1072)
 
 * Release 1.7.0 (2010-06-18)
 
diff --git a/src/allmydata/scripts/cli.py b/src/allmydata/scripts/cli.py
index 833d5d08..69672cc4 100644
--- a/src/allmydata/scripts/cli.py
+++ b/src/allmydata/scripts/cli.py
@@ -429,6 +429,7 @@ subCommands = [
     ["put", None, PutOptions, "Upload a file into the grid."],
     ["cp", None, CpOptions, "Copy one or more files."],
     ["rm", None, RmOptions, "Unlink a file or directory on the grid."],
+    ["unlink", None, RmOptions, "Unlink a file or directory on the grid (same as rm)."],
     ["mv", None, MvOptions, "Move a file within the grid."],
     ["ln", None, LnOptions, "Make an additional link to an existing file."],
     ["backup", None, BackupOptions, "Make target dir look like local dir."],
@@ -543,6 +544,7 @@ dispatch = {
     "put": put,
     "cp": cp,
     "rm": rm,
+    "unlink": rm,
     "mv": mv,
     "ln": ln,
     "backup": backup,
diff --git a/src/allmydata/test/test_cli.py b/src/allmydata/test/test_cli.py
index 70746b7d..05d49331 100644
--- a/src/allmydata/test/test_cli.py
+++ b/src/allmydata/test/test_cli.py
@@ -2435,6 +2435,9 @@ class Rm(GridTestMixin, CLITestMixin, unittest.TestCase):
     def test_rm_without_alias(self):
         # 'tahoe rm' should behave sensibly when invoked without an explicit
         # alias before the default 'tahoe' alias has been created.
+
+        d.addCallback(lambda ign: self.do_cli("unlink", "afile"))
+        d.addCallback(_check)
         self.basedir = "cli/Rm/rm_without_alias"
         self.set_up_grid()
         d = self.do_cli("rm", "afile")
@@ -2449,6 +2452,9 @@ class Rm(GridTestMixin, CLITestMixin, unittest.TestCase):
         # 'tahoe rm' should behave sensibly when invoked with an explicit
         # alias that doesn't exist.
         self.basedir = "cli/Rm/rm_with_nonexistent_alias"
+
+        d.addCallback(lambda ign: self.do_cli("unlink", "nonexistent:afile"))
+        d.addCallback(_check)
         self.set_up_grid()
         d = self.do_cli("rm", "nonexistent:afile")
         def _check((rc, out, err)):
-- 
2.45.2