I am usually working with several branches of a same project. And sometimes I need to update same file(s) in each branch.

Change and commit on branch, and then merge it to others should be OK. (Also supported well by Perfore). But sometimes I just want edit them manually in a same changelist. So command alias below helps a lot.

RELEASES='1.1 1.1.3 mainline'
alias release_dirs='_(){ TMP_P=pwd |cut -d / -f 7-;\
for REL in $RELEASES;\ do echo /home/user/workspaces/$REL/a_fixed_path_in_my_proj/$TMP_P/$1;\
done }; _'

Then I can use it under whatever branch, for example

cd /home/user/workspaces/mainline/a_fixed_path_in_my_proj/lib/app_a/doc/
release_dirs ./release_notes.xml | xargs p4 edit
release_dirs ./release_notes.xml | xargs gedit

Tips here I want to mention is that shell script can be used in alias definition. Somehow magic,

alias somecmd='_(){ somescript }; _'

It’s simple to understand, create and function which name is _, and then call it. 🙂