Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SVN file deletions #1

Open
paulgibbs opened this issue Mar 24, 2016 · 2 comments
Open

SVN file deletions #1

paulgibbs opened this issue Mar 24, 2016 · 2 comments

Comments

@paulgibbs
Copy link
Member

Brainstorming possible solutions per https://github.com/buddypress/bp-sync-to-wporg/blob/master/bp-sync-to-wporg#L39

@paulgibbs
Copy link
Member Author

Here's one approach. It uses the xmlstarlet package to parse XML (seems to be fairly popular -- it's on Ubuntu and Debian, at least, and on Mac OS X via brew)

svn status --xml | xmlstarlet sel -t -m '//entry[descendant::wc-status/@item="missing"]/@path' -v . -n | xargs svn rm

I did start by svn status | grep '?' | cut -c9- etc, but was worried about weird edge cases with whitespace in path names (that cut syntax is probably wrong, too, this is just an example from memory) so I wanted to use the XML output so we got the definite path to the removed files.

@boonebgorges
Copy link
Member

xmlstarlet looks smart.

Here's another one-liner, which detects ! and uses awk {print $2}, similar to cut. This seems reasonably safe to me, but I suppose you're right that there could be edge cases.

svn status prints nothing but ! deleted/file.php, so this might be good enough:

svn status | sed -rn "s/^\!\s+(.*)/\2/p" | xargs svn rm

where /p prints the captured group (.*) instead of the whole matched line

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants