On Thu, Apr 26, 2007 at 10:20:16PM +0800, Jason Zhao wrote: > How about this: > > if [[ $SCM_MODE == "unknown" ]];then > print -u2 "Unable to determine SCM type currently in use." > print -u2 "For teamware: please looks for \$CODEMGR_WS either in" > print -u2 " the environment or in the file list." > print -u2 "For mercurial: please runs 'hg root'." > exit 1
"please"? You could put $0 if you want to be generic, or hardcode it to xref. But I think the logic implied by the text is backwards. I think it's probably best left to the man page for explanation. > >>function detect_scm > >>{ > >> # > >> # The presence of $CODEMGR_WS and a Codemgr_wsdata directory > >> # is our clue that this is a teamware workspace. > >> # > >> if [[ -n $CODEMGR_WS && -d "$CODEMGR_WS/Codemgr_wsdata" ]]; then > >> > > > >Wouldn't the output of workspace name be more appropriate here? > > > I am not sure what you meant? > output the workspace name? No, sorry; I meant the output of the command "workspace name". > I made a test,the time take almost the same for "hg locate" and "hg manifest" > in the directory of "hg root",see below. > ######### hg locate "glob:$dir/**/${pat#s.}" ######### > # time flg.flp -r > ...... > real 3m38.654s > user 2m41.522s > sys 0m24.115s > > ######### hg manifest | grep "^$dir/.*/${pat#s.}\$" ####### > # time flg.flp -r > ...... > real 10m11.090s > user 8m2.345s > sys 0m45.250s Hm. I'm not seeing "almost the same" times, but that manifest takes nearly three times as long. Weird. But then again, I was testing just the hg commands, and not all of flg.flp, so maybe something else is going on. Do you get similar differences when just running the hg commands? > Then I have an idea,why couldn't we establish a snapshot of all filelist when > the workspace is detected as "mercurial",then try to find the $dir/${pat#s.} > in > this snapshot.Is it a better,I am modifying the script to make a test.Like > this: Hm. The command is run multiple times. I'd probably just find a way to not have to do that. Something like for dir; do dirs="$dirs|$dir" done dirs=${dirs#|} hg manifest | egrep "^($dirs)/.*/${pat#s.}\$" or something like that. I dunno if that'd actually do what needs to happen there. > >> while read srcfile; do > >> if [ "$RELPATHS" != y -o $CURTREE = $codemgr_ws ]; then > > > >Why the change of adding "-o $CURTREE = $codemgr_ws"? > > > This is because when I run "flg.flp -r" at $CODEMGR_WS($CURTREE is > $CODEMGR_WS), So this is a pre-existing bug? > >>if [ "${SUBTREE##$codemgr_ws}" = "$SUBTREE" ]; then > >> fail "$SUBTREE is not a subtree of Workspace" > >>fi > >> > >>if [ "${CURTREE##$codemgr_ws}" = "$CURTREE" ]; then > >> fail "$CURTREE is not a subtree of Workspace" > >>fi > >> > > > >These used to read "$SUBTREE is not a subtree of \$CODEMGR_WS"; presumably > >this change isn't related to making this work with mercurial, is it? (It > >may be a perfectly good change, but should probably fall under a different > >bugid). > > > yes,I think it may relate to mercurial. > If the SUBTREE donot in the "hg root",it will not run without fault. > Maybe I will change like it. > > fail "$SUBTREE is not a subtree of $codemgr_ws" Right, that's what I'd expect. Danek