[PATCH] add "root" command
authormpm@selenic.com
Fri, 24 Jun 2005 23:22:46 -0800
changeset 468 157675add351
parent 467 9d5447a366a7
child 469 e205194ca7ef
[PATCH] add "root" command -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 [PATCH] add "root" command From: Bryan O'Sullivan <bos@serpentine.com> Add "root" command Useful for scripting. manifest hash: a2df76139130ac034e53872f24f21f31b083bc42 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCvQZGywK+sNU5EO8RAtYSAKCKRyuxzcDOTV9q+GY5WZDJ/VZgzwCfXhut VvGtiSnIqoBeQ/PtPsokMb0= =gUsq -----END PGP SIGNATURE-----
mercurial/commands.py
tests/test-help.out
--- a/mercurial/commands.py	Fri Jun 24 23:20:30 2005 -0800
+++ b/mercurial/commands.py	Fri Jun 24 23:22:46 2005 -0800
@@ -602,6 +602,10 @@
     """remove the specified files on the next commit"""
     repo.remove(relpath(repo, (file,) + files))
 
+def root(ui, repo):
+    """print the root (top) of the current working dir"""
+    ui.write(repo.root + "\n")
+
 def serve(ui, repo, **opts):
     """export the repository via HTTP"""
     hgweb.server(repo.root, opts["name"], opts["templates"],
@@ -748,6 +752,7 @@
                   'hg rawcommit [options] [files]'),
     "recover": (recover, [], "hg recover"),
     "remove|rm": (remove, [], "hg remove [files]"),
+    "root": (root, [], "hg root"),
     "serve": (serve, [('p', 'port', 8000, 'listen port'),
                       ('a', 'address', '', 'interface address'),
                       ('n', 'name', os.getcwd(), 'repository name'),
--- a/tests/test-help.out	Fri Jun 24 23:20:30 2005 -0800
+++ b/tests/test-help.out	Fri Jun 24 23:22:46 2005 -0800
@@ -24,6 +24,7 @@
  rawcommit   raw commit interface
  recover     roll back an interrupted transaction
  remove      remove the specified files on the next commit
+ root        print the root (top) of the current working dir
  serve       export the repository via HTTP
  status      show changed files in the working directory
  tag         add a tag for the current tip or a given revision
@@ -74,6 +75,7 @@
  rawcommit   raw commit interface
  recover     roll back an interrupted transaction
  remove      remove the specified files on the next commit
+ root        print the root (top) of the current working dir
  serve       export the repository via HTTP
  status      show changed files in the working directory
  tag         add a tag for the current tip or a given revision