##// END OF EJS Templates
remove: support remove with explicit paths in subrepos
Matt Harbison -
r23326:f6b8d234 default
parent child Browse files
Show More
@@ -2060,8 +2060,16 b' def remove(ui, repo, m, prefix, after, f'
2060 2060
2061 2061 wctx = repo[None]
2062 2062
2063 if subrepos:
2064 for subpath in sorted(wctx.substate):
2063 for subpath in sorted(wctx.substate):
2064 def matchessubrepo(matcher, subpath):
2065 if matcher.exact(subpath):
2066 return True
2067 for f in matcher.files():
2068 if f.startswith(subpath):
2069 return True
2070 return False
2071
2072 if subrepos or matchessubrepo(m, subpath):
2065 2073 sub = wctx.sub(subpath)
2066 2074 try:
2067 2075 submatch = matchmod.narrowmatcher(subpath, m)
@@ -2080,7 +2088,7 b' def remove(ui, repo, m, prefix, after, f'
2080 2088 return True
2081 2089 return False
2082 2090
2083 if f in repo.dirstate or f in wctx.dirs() or (subrepos and insubrepo()):
2091 if f in repo.dirstate or f in wctx.dirs() or insubrepo():
2084 2092 continue
2085 2093
2086 2094 if os.path.exists(m.rel(join(f))):
@@ -130,8 +130,10 b' Interaction with Mercurial Commands'
130 130 ignored.
131 131
132 132 :remove: remove does not recurse into subrepositories unless
133 -S/--subrepos is specified. Git and Subversion subrepositories
134 are currently silently ignored.
133 -S/--subrepos is specified. However, if you specify a file or
134 directory path in a subrepo, it will be removed even without
135 -S/--subrepos. Git and Subversion subrepositories are currently
136 silently ignored.
135 137
136 138 :update: update restores the subrepos in the state they were
137 139 originally committed in target changeset. If the recorded
@@ -120,6 +120,14 b' Check that deep archiving works'
120 120 R sub1/sub2/folder/test.txt
121 121 R sub1/sub2/test.txt
122 122 $ hg update -Cq
123 $ hg remove -I 're:.*.txt' sub1
124 $ hg status -S
125 $ hg remove sub1/sub2/folder/test.txt
126 $ hg remove sub1/.hgsubstate
127 $ hg status -S
128 R sub1/.hgsubstate
129 R sub1/sub2/folder/test.txt
130 $ hg update -Cq
123 131
124 132 $ hg --config extensions.largefiles=! archive -S ../archive_all
125 133 $ find ../archive_all | sort
General Comments 0
You need to be logged in to leave comments. Login now