# short commands
co=edit
ci=submit
st=status

# new commands
shelved=changes -s shelved -u $(P4USER) -c $(P4CLIENT)
pending=changes -s pending -u $(P4USER) -c $(P4CLIENT)
desc=describe -s
purge=clean -I
blame=annotate -u
lc=-F "%change%" -ztag changes -m1 -s submitted ... > $(chg)&& describe -s $(chg)
copyup= -F "%baseParent%" -ztag stream -o > $(parent) &&
        -F "%Name%" -ztag stream -o > $(current) &&
        switch $(parent) &&
        merge --from $(current) &&
        resolve -as &&
        submit -d "Pulling crud to main" &&
        switch $(current)


nuke-shelf $(change)=shelve -dc $(change) && revert -c $(change) //... && change -d $(change)
nc $(desc) = --field Description$(EQ)$(desc) change -o > $(form) && change -i < $(form)
newChange $(desc) = change -o > $(chg) &&
                       p4subst "$(LT)enter.*$(GT)" $(desc) < $(chg) > $(chg2) &&
                       change -i < $(chg2)

# one shot move!
mv $(from) $(to) = edit $(from) && move $(from) $(to)

# one shot reconcile and submit a la git commit -am
su $(description)=rec && submit -d $(description)

# cp takes a snapshot of WIP and puts it into the active shelf
auto_shelved = -ztag -F %change% changes -s shelved -u $(P4USER) -c $(P4CLIENT) ...
cp = auto_shelved > $(chg) && rec -c $(chg) && shelve -c $(chg) -r

# what shelves are on my shared server? Single arg and no arg versions.
remote-shelves $(remote) = -F %Address% -ztag remote -o $(remote) > $(port) && 
             -p $(port) -u $(P4USER) changes -s shelved -u $(P4USER)

remote-shelves = remote-shelves origin

nuke-it-from-orbit = -F %clientRoot% -ztag info > $(root) && revert //... && clean $(root)/... && sync

refresh-aliases = -u guest -p workshop.perforce.com:1666 print -o /Users/matt/.p4aliases -q //guest/matt_attaway/scripts/.p4aliases

full-changes $(rev) = -ztag -F %change% changes $(rev) > $(changes) && -x - describe -s < $(changes)