Patrick Mézard avatar Patrick Mézard committed 7403cc6

test-forest: move path rewriting calls in a function

Comments (0)

Files changed (1)

 
 #alias hg='hg --traceback'
 
+fixpath()
+{
+    sed -e "s@\(/private\)*$HGTMP@HGTMP@g"
+}
+
 HGRCPATH=$HGTMP/.hgrc
 export HGRCPATH
 echo "[extensions]" >> $HGRCPATH
 hg fseed -R newtop top-snap default
 rm -rf newtop
 hg fseed --traceback --root newtop top-snap default >/dev/null
-hg fsnap --cwd newtop --compatible | sed "s@\(/private\)*$HGTMP@HGTMP@g"
-hg fsnap --cwd newtop | sed "s@\(/private\)*$HGTMP@HGTMP@g"
+hg fsnap --cwd newtop --compatible | fixpath
+hg fsnap --cwd newtop | fixpath
 rm -rf newtop
 
 echo "# fpull"
 hg fpull --cwd topcopy -u --snapfile=../top-snap default 2>&1 \
-    | sed "s@\(/private\)*$HGTMP@HGTMP@g"
+    | fixpath
 hg fpull --cwd topcopy -u ../top-snap default 2>&1 \
-    | sed "s@\(/private\)*$HGTMP@HGTMP@g"
+    | fixpath
 # Simulate a new repository
 rm -rf topcopy/t
 hg fpull -R topcopy -u 2>&1 \
-    | sed "s@\(/private\)*$HGTMP@HGTMP@g"
+    | fixpath
 
 echo "# foutgoing"
 echo "t/t/f" > topcopy/t/t/f
 hg commit --cwd topcopy/t/t -m "delete new line" -d "0 0"
 hg remove --cwd topcopy/d/d f2
 hg commit -R topcopy -m "remove new file" -d "0 0"
-hg foutgoing -R topcopy 2>&1 | sed "s@\(/private\)*$HGTMP@HGTMP@g"
-hg foutgoing --cwd topcopy default 2>&1 | sed "s@\(/private\)*$HGTMP@HGTMP@g"
-hg foutgoing -R topcopy foo 2>&1 | sed "s@\(/private\)*$HGTMP@HGTMP@g"
+hg foutgoing -R topcopy 2>&1 | fixpath
+hg foutgoing --cwd topcopy default 2>&1 | fixpath
+hg foutgoing -R topcopy foo 2>&1 | fixpath
 
 echo "# fincoming"
-hg fincoming -R toplevel topcopy 2>&1 | sed "s@\(/private\)*$HGTMP@HGTMP@g"
-hg fincoming --cwd toplevel ../topcopy 2>&1 | sed "s@\(/private\)*$HGTMP@HGTMP@g"
-hg fincoming -R toplevel foo 2>&1 | sed "s@\(/private\)*$HGTMP@HGTMP@g"
+hg fincoming -R toplevel topcopy 2>&1 | fixpath
+hg fincoming --cwd toplevel ../topcopy 2>&1 | fixpath
+hg fincoming -R toplevel foo 2>&1 | fixpath
 
 echo "# fpush"
-hg fpush -R topcopy top-snap default | sed "s@\(/private\)*$HGTMP@HGTMP@g"
+hg fpush -R topcopy top-snap default | fixpath
 
 echo "# fseed and fpull, missing section"
 cat top-snap | \
 hg ftrees -R missing --convert
 # pull (should find toplevel changesets)
 hg fpull -R missing top-snap-missing default 2>&1 \
-    | sed "s@\(/private\)*$HGTMP@HGTMP@g"
+    | fixpath
 rm -rf missing
 
 echo "# fseed and fpull, named section"
 hg ftrees --cwd named --convert
 # pull (should find nothing)
 hg fpull --cwd named ../top-snap-named default 2>&1 \
-    | sed "s@\(/private\)*$HGTMP@HGTMP@g"
+    | fixpath
 rm -rf named
 
 # create an mq patch in topcopy/t
 
 echo "# fpull + mq"
 hg fpull --cwd topcopy -u ../top-snap default 2>&1 \
-    | sed "s@\(/private\)*$HGTMP@HGTMP@g"
+    | fixpath
 
 echo "# fpush + mq"
 hg fpush --cwd topcopy ../top-snap default 2>&1 \
-    | sed "s@\(/private\)*$HGTMP@HGTMP@g"
+    | fixpath
 
 echo "# fupdate + mq"
 hg fupdate --cwd topcopy
 echo "b" >partial/b/f
 hg commit --cwd partial/a -A -m init -d "0 0"
 hg commit --cwd partial/b -A -m init -d "0 0"
-hg fclone partial partial-clone | sed "s@\(/private\)*$HGTMP@HGTMP@g"
+hg fclone partial partial-clone | fixpath
 rm -rf partial-clone/b
-hg --cwd partial-clone fpull --partial 2>&1 | sed "s@\(/private\)*$HGTMP@HGTMP@g"
+hg --cwd partial-clone fpull --partial 2>&1 | fixpath
 echo "[forest]" >> partial-clone/.hg/hgrc
 echo "partial = Yes" >> partial-clone/.hg/hgrc
-hg --cwd partial-clone fpull 2>&1 | sed "s@\(/private\)*$HGTMP@HGTMP@g"
+hg --cwd partial-clone fpull 2>&1 | fixpath
 echo "[forest]" >> partial-clone/.hg/hgrc
 echo "partial = No" >> partial-clone/.hg/hgrc
-hg --cwd partial-clone fpull 2>&1 | sed "s@\(/private\)*$HGTMP@HGTMP@g"
+hg --cwd partial-clone fpull 2>&1 | fixpath
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.