Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P1732
arc_preview
Active
Public
Actions
Authored by
•
sshannin
on Mar 4 2015, 6:33 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
Arcanist
Referenced Files
F329617: arc_preview
Mar 4 2015, 6:33 PM
2015-03-04 18:33:16 (UTC+0)
Subscribers
None
#!/bin/bash
set
-e
usage
()
{
echo
"Usage: arc_preview [ -d Diff ID ]"
echo
""
echo
"Will detect your local arc Diff ID and your local svn repo"
echo
"to provide a diff of what has changed. This semantically"
echo
"should tell you what has changed since your last 'arc diff'."
echo
"If -d is provided, it will be used as the Diff ID rather than"
echo
"detecting and using your most recent diff."
exit
1
}
diff
=
""
while
getopts
":d:"
opt
;
do
case
"
$opt
"
in
d
)
diff
=
$OPTARG
;;
*
)
usage
;;
esac
done
if
[
-z
"
$diff
"
]
;
then
diff
=
`
arc which
|
grep -o
"D[1-9][0-9]*"
`
fi
base_checkout
=
`
svn info
|
grep ^URL
|
cut -d
" "
-f2
`
if
[
-z
"
$diff
"
]
;
then
echo
"Unable to find diff for working directory"
exit
fi
if
[
-z
"
$base_checkout
"
]
;
then
echo
"Unable to find svninfo for working directory"
exit
fi
echo
"Diff is
$diff
"
echo
"Base Revision is
$base_checkout
"
curr_dir
=
`
pwd
`
## start with a fresh tmp dir
tmp_dir
=
`
mktemp -d
`
function
cleanup
{
rm -rf
$tmp_dir
}
trap
'cleanup'
EXIT
## checkout the base revision and apply the patch
svn co
$base_checkout
$tmp_dir
--quiet
cd
$tmp_dir
## patch it up and hide some noise
arc patch --force
${
diff
}
|
grep -v
"^patching file"
|
grep -v
"^[A|U|D] "
cd
$curr_dir
## perform our diff
diff -ru
$tmp_dir
$curr_dir
--exclude
=
".svn"
Event Timeline
•
sshannin
edited the content of this paste.
(Show Details)
Mar 4 2015, 6:33 PM
2015-03-04 18:33:16 (UTC+0)
•
sshannin
changed the title of this paste from untitled to
arc_preview
.
•
sshannin
updated the paste's language from
autodetect
to
bash
.
•
sshannin
added a project:
Arcanist
.
•
sshannin
mentioned this in
T1084: Preview what's new in a diff when attaching it to an existing revision
.
chad
mentioned this in
T7466: Chome 41 has weird scroll jitter with Paste embeds
.
Mar 5 2015, 4:53 PM
2015-03-05 16:53:14 (UTC+0)
Log In to Comment