code: func MergeServicesV2(existingServices *ServiceConfigs, environmentLookup EnvironmentLookup, resourceLookup ResourceLookup, file string, datas RawServiceMap, options *ParseOptions) (map[string]*ServiceConfig, error) {
  	if options.Validate {
  		if err := validateV2(datas); err != nil {
  			return nil, err
  		}
  	}
  
  	for name, data := range datas {
  		data, err := parseV2(resourceLookup, environmentLookup, file, data, datas, options)
  		if err != nil {
  			logrus.Errorf("Failed to parse service %s: %v", name, err)
  			return nil, err
  		}
  
  		if serviceConfig, ok := existingServices.Get(name); ok {
  			var rawExistingService RawService
  			if err := utils.Convert(serviceConfig, &rawExistingService); err != nil {
  				return nil, err
  			}
  
  			data = mergeConfig(rawExistingService, data)
  		}
  
  		datas[name] = data
  	}
  
  	if options.Validate {
  		var errs []string
  		for name, data := range datas {
  			err := validateServiceConstraintsv2(data, name)
  			if err != nil {
  				errs = append(errs, err.Error())
  			}
  		}
  		if len(errs) != 0 {
  			return nil, fmt.Errorf(strings.Join(errs, "\n"))
  		}
  	}
  
  	serviceConfigs := make(map[string]*ServiceConfig)
  	if err := utils.Convert(datas, &serviceConfigs); err != nil {
  		return nil, err
  	}
  
  	return serviceConfigs, nil
  }
docs: // MergeServicesV2 merges a v2 compose file into an existing set of service configs