anchor.diff:      Dep = #dep { app = App,
                    vsn_regex = VsnRegex,
                    source = Source },
  -    case is_app_available(App, VsnRegex) of
  -        {true, AppDir} ->
  -            find_deps(Mode, Rest, acc_deps(Mode, avail, Dep, AppDir, Acc));
  -        {false, _} ->
  -            AppDir = filename:join(get_deps_dir(), Dep#dep.app),
  -            case is_app_available(App, VsnRegex, AppDir) of
  -                {true, AppDir} ->
  -                    find_deps(Mode, Rest,
  -                              acc_deps(Mode, avail, Dep, AppDir, Acc));
  -                {false, _} ->
  -                    find_deps(Mode, Rest,
  -                              acc_deps(Mode, missing, Dep, AppDir, Acc))
  -            end
  -    end;
  +    {Availability, FoundDir} = find_dep(Dep),
  +    find_deps(Mode, Rest, acc_deps(Mode, Availability, Dep, FoundDir, Acc));
   find_deps(_Mode, [Other | _Rest], _Acc) ->
       ?ABORT("Invalid dependency specification ~p in ~s\n",
              [Other, rebar_utils:get_cwd()]).
  +
  +find_dep(Dep) ->
  +    % Find a dep based on its source,
  +    % e.g. {git, "https://github.com/mochi/mochiweb.git", "HEAD"}
  +    % Deps with a source must be found (or fetched) locally.
  +    % Those without a source may be satisfied from lib directories (get_lib_dir).
  +    find_dep(Dep, Dep#dep.source).
  +
  +find_dep(Dep, undefined) ->
  +    % 'source' is undefined.  If Dep is not satisfied locally,
  +    % go ahead and find it amongst the lib_dir's.
  +    case find_dep_in_dir(Dep, get_deps_dir(Dep#dep.app)) of
  +        {avail, Dir} -> {avail, Dir};
  +        {missing, _} -> find_dep_in_dir(Dep, get_lib_dir(Dep#dep.app))
  +    end;
  +find_dep(Dep, _Source) ->
  +    % _Source is defined.  Regardless of what it is, we must find it
  +    % locally satisfied or fetch it from the original source
  +    % into the project's deps
  +    find_dep_in_dir(Dep, get_deps_dir(Dep#dep.app)).
  +
  +find_dep_in_dir(_Dep, {false, Dir}) ->
  +    {missing, Dir};
  +find_dep_in_dir(Dep, {true, Dir}) ->
  +    App = Dep#dep.app,
  +    VsnRegex = Dep#dep.vsn_regex,
  +    case is_app_available(App, VsnRegex, Dir) of
  +        {true, _AppFile} -> {avail, Dir};
  +        {false, _}       -> {missing, Dir}
  +    end.
   
   acc_deps(find, avail, Dep, AppDir, {Avail, Missing}) ->
       {[Dep#dep { dir = AppDir } | Avail], Missing};
  
positive.code:     true = source_engine_avail(Source),
      ok.
  
  is_app_available(App, VsnRegex) ->
      case code:lib_dir(App) of
          {error, bad_name} ->
              {false, bad_name};
          Path ->
              is_app_available(App, VsnRegex, Path)
      end.
  
  is_app_available(App, VsnRegex, Path) ->
      case rebar_app_utils:is_app_dir(Path) of
          {true, AppFile} ->
              case rebar_app_utils:app_name(AppFile) of
  
negative.code:     %% VCS directory, such as when a source archive is built of a project, with
      %% all deps already downloaded/included. So, verify that the necessary VCS
      %% directory exists before attempting to do the update.
      {true, AppDir} = get_deps_dir(Dep#dep.app),
      case has_vcs_dir(element(1, Dep#dep.source), AppDir) of
          true ->
              ?CONSOLE("Updating ~p from ~p\n", [Dep#dep.app, Dep#dep.source]),
  