Patchwork [6,of,8,V3] addremove: add support for the -S flag

login
register
mail settings
Submitter Matt Harbison
Date Dec. 12, 2014, 3:35 a.m.
Message ID <c80a67bfe20d133bfa3b.1418355318@Envy>
Download mbox | patch
Permalink /patch/7060/
State Accepted
Commit ccfb56450f21e627d8d960a15e00b8d27176693a
Headers show

Comments

Matt Harbison - Dec. 12, 2014, 3:35 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1416891086 18000
#      Mon Nov 24 23:51:26 2014 -0500
# Node ID c80a67bfe20d133bfa3b93fb36859380a7c54bbe
# Parent  f082b5a5d4eb14f7aaba6c24ce48a881fcfb3cc4
addremove: add support for the -S flag

Git and svn subrepos are currently not supported.  It doesn't look like git or
svn have these commands natively, so that's an area for a git or svn expert.
Martin von Zweigbergk - Dec. 12, 2014, 5:59 p.m.
On Thu Dec 11 2014 at 7:36:23 PM Matt Harbison <mharbison72@gmail.com>
wrote:

> # HG changeset patch
> # User Matt Harbison <matt_harbison@yahoo.com>
> # Date 1416891086 18000
> #      Mon Nov 24 23:51:26 2014 -0500
> # Node ID c80a67bfe20d133bfa3b93fb36859380a7c54bbe
> # Parent  f082b5a5d4eb14f7aaba6c24ce48a881fcfb3cc4
> addremove: add support for the -S flag
>
> Git and svn subrepos are currently not supported.  It doesn't look like
> git or
> svn have these commands natively,


'git add -A'?

(These days (git version >= 2.0.0), 'git add' also deals with removals, but
-A is BC.)

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -204,7 +204,7 @@ 
     return rejected and 1 or 0
 
 @command('addremove',
-    similarityopts + walkopts + dryrunopts,
+    similarityopts + subrepoopts + walkopts + dryrunopts,
     _('[OPTION]... [FILE]...'),
     inferrepo=True)
 def addremove(ui, repo, *pats, **opts):
diff --git a/mercurial/help/subrepos.txt b/mercurial/help/subrepos.txt
--- a/mercurial/help/subrepos.txt
+++ b/mercurial/help/subrepos.txt
@@ -81,6 +81,10 @@ 
     Git and Subversion subrepositories are currently silently
     ignored.
 
+:addremove: addremove does not recurse into subrepos unless
+    -S/--subrepos is specified.  Git and Subversion subrepositories
+    will print a warning and continue.
+
 :archive: archive does not recurse in subrepositories unless
     -S/--subrepos is specified.
 
diff --git a/tests/test-completion.t b/tests/test-completion.t
--- a/tests/test-completion.t
+++ b/tests/test-completion.t
@@ -215,7 +215,7 @@ 
   status: all, modified, added, removed, deleted, clean, unknown, ignored, no-status, copies, print0, rev, change, include, exclude, subrepos, template
   summary: remote
   update: clean, check, date, rev, tool
-  addremove: similarity, include, exclude, dry-run
+  addremove: similarity, subrepos, include, exclude, dry-run
   archive: no-decode, prefix, rev, type, subrepos, include, exclude
   backout: merge, parent, rev, edit, tool, include, exclude, message, logfile, date, user
   bisect: reset, good, bad, skip, extend, command, noupdate
diff --git a/tests/test-subrepo-deep-nested-change.t b/tests/test-subrepo-deep-nested-change.t
--- a/tests/test-subrepo-deep-nested-change.t
+++ b/tests/test-subrepo-deep-nested-change.t
@@ -128,11 +128,32 @@ 
   R sub1/.hgsubstate
   R sub1/sub2/folder/test.txt
   $ hg update -Cq
+  $ touch sub1/foo
+  $ hg forget sub1/sub2/folder/test.txt
+  $ rm sub1/sub2/test.txt
+
+Test relative path printing + subrepos
+  $ mkdir -p foo/bar
+  $ cd foo
+  $ touch bar/abc
+  $ hg addremove -S ..
+  adding ../sub1/sub2/folder/test.txt (glob)
+  removing ../sub1/sub2/test.txt (glob)
+  adding ../sub1/foo (glob)
+  adding bar/abc (glob)
+  $ cd ..
+  $ hg status -S
+  A foo/bar/abc
+  A sub1/foo
+  R sub1/sub2/test.txt
+  $ hg update -Cq
   $ rm sub1/sub2/folder/test.txt
   $ rm sub1/sub2/test.txt
   $ hg ci -ASm "remove test.txt"
   removing sub1/sub2/folder/test.txt (glob)
   removing sub1/sub2/test.txt (glob)
+  adding sub1/foo (glob)
+  adding foo/bar/abc
   committing subrepository sub1
   committing subrepository sub1/sub2 (glob)
   $ hg rollback -q