diff --git a/conans/client/cmd/export.py b/conans/client/cmd/export.py
index 910842592..cc38d61eb 100644
--- a/conans/client/cmd/export.py
+++ b/conans/client/cmd/export.py
@@ -69,12 +69,17 @@ def _capture_export_scm_data(conanfile, conanfile_dir, destination_folder, outpu
         os.unlink(scm_src_file)
 
     scm_data = get_scm_data(conanfile)
-    captured_revision = scm_data.capture_revision if scm_data else False
+    if not scm_data:
+        return None, False
 
-    if not scm_data or not (scm_data.capture_origin or scm_data.capture_revision):
-        return None, captured_revision
+    # Resolve SCMData in the user workspace (someone may want to access CVS or import some py)
+    captured_revision = scm_data.capture_revision
 
     scm = SCM(scm_data, conanfile_dir, output)
+    if scm_data.capture_origin or scm_data.capture_revision:
+        # Generate the scm_folder.txt file pointing to the src_path
+        src_path = scm.get_repo_root()
+        save(scm_src_file, src_path.replace("\\", "/"))
 
     if scm_data.url == "auto":
         origin = scm.get_qualified_remote_url()
@@ -84,17 +89,14 @@ def _capture_export_scm_data(conanfile, conanfile_dir, destination_folder, outpu
             output.warn("Repo origin looks like a local path: %s" % origin)
         output.success("Repo origin deduced by 'auto': %s" % origin)
         scm_data.url = origin
+
     if scm_data.revision == "auto":
         if not scm.is_pristine():
             output.warn("Repo status is not pristine: there might be modified files")
         scm_data.revision = scm.get_revision()
         output.success("Revision deduced by 'auto': %s" % scm_data.revision)
 
-    # Generate the scm_folder.txt file pointing to the src_path
-    src_path = scm.get_repo_root()
-    save(scm_src_file, src_path.replace("\\", "/"))
-    _replace_scm_data_in_conanfile(os.path.join(destination_folder, "conanfile.py"),
-                                   scm_data)
+    _replace_scm_data_in_conanfile(os.path.join(destination_folder, "conanfile.py"), scm_data)
 
     return scm_data, captured_revision
 
@@ -146,7 +148,6 @@ def _replace_scm_data_in_conanfile(conanfile_path, scm_data):
     content = content if not headers else ''.join(headers) + content
     save(conanfile_path, content)
 
-
 def _export_conanfile(conanfile_path, output, client_cache, conanfile, conan_ref, keep_source):
 
     exports_folder = client_cache.export(conan_ref)

[SCM] [SVN] auto feature behavior depends on how user has checked out local working copy


- [x] I've read the [CONTRIBUTING guide](https://raw.githubusercontent.com/conan-io/conan/develop/.github/CONTRIBUTING.md).
- [x] I've specified the Conan version, operating system version and any tool that can be relevant.
- [x] I've explained the steps to reproduce the error or the motivation/use case of the question/suggestion.

Conan 1.8.2
Python 3.6.5
Windows 7
SVN 1.9.5

Our SVN repository structure is like this:
```
module1/<trunk|tags|branches>/conanfile.py
module2/<trunk|tags|branches>/conanfile.py
...
```

We have the following scm statement in our conanfile.py
```
scm = {
    "type": "svn",
    "url": "auto",
    "revision": "auto",
}
```

The current behavior when calling `conan create` depends on whether someone has checked out all modules from SVN or only one module.

Scenario A:
User A has checked out only module1 from SVN repository `https://svn_repo/module1/trunk` to a local folder `C:\svn\module1\trunk`.
Location of .svn hidden folder: `C:\svn\module1\trunk\.svn`
Location of conan file: `C:\svn\module1\trunk\conanfile.py`
Conan command: `conan create  C:\svn\module1\trunk  user/channel`
In this case the conan SVN scm auto feature behaves like expected.
The conan cache source folder afterwards contains exactly the same content as the local SVN working copy folder for which conan create was called.

Scenario B:
User B has checked out all modules from SVN repository `https://svn_repo` to a local folder `C:\svn`.
Location of .svn hidden folder: `C:\svn\.svn`
Location of conan file: `C:\svn\module1\trunk\conanfile.py`
Conan command: `conan create  C:\svn\module1\trunk  user/channel`
In this case the conan SVN scm auto feature behaves **not** like expected.
The conan cache source folder afterwards contains all modules (module1, module2, ...) instead of only module1 trunk, for which conan create was called.
So it contains the working copy of the SVN base folder 'https://svn_repo' instead of 'https://svn_repo/module1/trunk'

Expected behavior:
The source folder in the local conan cache should contain all subfolders of the local SVN folder where the conanfile.py is located for which conan create was called, not all root folders including other modules checked out locally by the user.
The behavior should not depend on the location of the hidden .svn directory which depends on how a user has checked out his/her local working copy.

Currently we cannot use the SVN scm auto feature, because a lot of users check out their SVN working copy like in scenario B.

Could you please give us a statement on this topic.

Thank You!
diff --git a/conans/test/functional/old/scm_test.py b/conans/test/functional/old/scm_test.py
index e32a0ef97..c4ced38f1 100644
--- a/conans/test/functional/old/scm_test.py
+++ b/conans/test/functional/old/scm_test.py
@@ -473,6 +473,81 @@ class ConanLib(ConanFile):
         data2 = json.loads(the_json)
         self.assertEquals(data, data2)
 
+    def test_git_delegated_function(self):
+        conanfile = """
+import os
+from conans import ConanFile
+from conans.client.tools.scm import Git
+
+def get_revision():
+    here = os.path.dirname(__file__)
+    git = Git(here)
+    return git.get_commit()
+
+def get_url():
+    def nested_url():
+        here = os.path.dirname(__file__)
+        git = Git(here)
+        return git.get_remote_url()
+    return nested_url()
+
+class MyLib(ConanFile):
+    name = "issue"
+    version = "3831"
+    scm = {'type': 'git', 'url': get_url(), 'revision': get_revision()}
+
+"""
+        self.client.save({"conanfile.py": conanfile})
+        path, commit = create_local_git_repo(folder=self.client.current_folder)
+        self.client.runner('git remote add origin "%s"' % path.replace("\\", "/"), cwd=path)
+
+        self.client.run("export . user/channel")
+        reference = ConanFileReference.loads("issue/3831@user/channel")
+        exported_conanfile = self.client.client_cache.conanfile(reference)
+        content = load(exported_conanfile)
+        self.assertIn(commit, content)
+
+    def test_delegated_python_code(self):
+        client = TestClient()
+        code_file = """
+import os
+from conans.tools import Git
+from conans import ConanFile
+
+def get_commit():
+    here = os.getcwd()
+    git = Git(here)
+    return git.get_commit()
+
+class MyLib(ConanFile):
+    pass
+"""
+        client.save({"conanfile.py": code_file})
+        client.run("export . tool/0.1@user/testing")
+
+        conanfile = """from conans import ConanFile, python_requires
+from conans.tools import load
+tool = python_requires("tool/0.1@user/testing")
+
+class MyLib(ConanFile):
+    scm = {'type': 'git', 'url': '%s', 'revision': tool.get_commit()}
+    def build(self):
+        self.output.info("File: {}".format(load("file.txt")))
+""" % client.current_folder.replace("\\", "/")
+
+        client.save({"conanfile.py": conanfile, "file.txt": "hello!"})
+        path, commit = create_local_git_repo(folder=client.current_folder)
+        client.runner('git remote add origin "%s"' % path.replace("\\", "/"), cwd=path)
+
+        client.run("export . pkg/0.1@user/channel")
+        reference = ConanFileReference.loads("pkg/0.1@user/channel")
+        exported_conanfile = client.client_cache.conanfile(reference)
+        content = load(exported_conanfile)
+        self.assertIn(commit, content)
+        # Check that everything works and is usable
+        client.run("install pkg/0.1@user/channel --build=missing")
+        self.assertIn("pkg/0.1@user/channel: File: hello!", client.out)
+
 
 @attr('svn')
 class SVNSCMTest(SVNLocalRepoTestCase):

pip install -e .[dev]
parse_log_pytest
requirements.txt
nose nose-cov pytest
apt-get update apt-get install -y gcc
3.6
conans/requirements.txt conans/requirements_server.txt conans/requirements_dev.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
astroid==2.11.7
attrs==22.2.0
beautifulsoup4==4.12.3
bottle==0.12.25
certifi==2021.5.30
charset-normalizer==2.0.12
codecov==2.1.13
colorama==0.4.5
-e git+https://github.com/conan-io/conan.git@e250f738c68383c06b46dde32fe386d160c5bd5a#egg=conan
cov-core==1.15.0
coverage==4.2
deprecation==2.0.7
dill==0.3.4
distro==1.1.0
fasteners==0.19
future==0.16.0
idna==3.10
importlib-metadata==4.8.3
importlib-resources==5.4.0
iniconfig==1.1.1
isort==5.10.1
lazy-object-proxy==1.7.1
mccabe==0.7.0
mock==1.3.0
node-semver==0.6.1
nose==1.3.7
nose-cov==1.6
packaging==21.3
parameterized==0.8.1
patch==1.16
pbr==6.1.1
platformdirs==2.4.0
pluggy==1.0.0
pluginbase==0.7
py==1.11.0
Pygments==2.14.0
PyJWT==1.7.1
pylint==2.13.9
pyparsing==3.1.4
pytest==7.0.1
PyYAML==3.13
requests==2.27.1
six==1.17.0
soupsieve==2.3.2.post1
tomli==1.2.3
tqdm==4.64.1
typed-ast==1.5.5
typing_extensions==4.1.1
urllib3==1.26.20
waitress==2.0.0
WebOb==1.8.9
WebTest==2.0.35
wrapt==1.16.0
zipp==3.6.0

name: conan
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - astroid==2.11.7
      - attrs==22.2.0
      - beautifulsoup4==4.12.3
      - bottle==0.12.25
      - charset-normalizer==2.0.12
      - codecov==2.1.13
      - colorama==0.4.5
      - cov-core==1.15.0
      - coverage==4.2
      - deprecation==2.0.7
      - dill==0.3.4
      - distro==1.1.0
      - fasteners==0.19
      - future==0.16.0
      - idna==3.10
      - importlib-metadata==4.8.3
      - importlib-resources==5.4.0
      - iniconfig==1.1.1
      - isort==5.10.1
      - lazy-object-proxy==1.7.1
      - mccabe==0.7.0
      - mock==1.3.0
      - node-semver==0.6.1
      - nose==1.3.7
      - nose-cov==1.6
      - packaging==21.3
      - parameterized==0.8.1
      - patch==1.16
      - pbr==6.1.1
      - platformdirs==2.4.0
      - pluggy==1.0.0
      - pluginbase==0.7
      - py==1.11.0
      - pygments==2.14.0
      - pyjwt==1.7.1
      - pylint==2.13.9
      - pyparsing==3.1.4
      - pytest==7.0.1
      - pyyaml==3.13
      - requests==2.27.1
      - six==1.17.0
      - soupsieve==2.3.2.post1
      - tomli==1.2.3
      - tqdm==4.64.1
      - typed-ast==1.5.5
      - typing-extensions==4.1.1
      - urllib3==1.26.20
      - waitress==2.0.0
      - webob==1.8.9
      - webtest==2.0.35
      - wrapt==1.16.0
      - zipp==3.6.0
prefix: /opt/conda/envs/conan

conans/test/functional/old/scm_test.py::GitSCMTest::test_git_delegated_function
conans/test/functional/old/scm_test.py::GitSCMTest::test_auto_conanfile_no_root conans/test/functional/old/scm_test.py::GitSCMTest::test_auto_filesystem_remote_git conans/test/functional/old/scm_test.py::GitSCMTest::test_auto_git conans/test/functional/old/scm_test.py::GitSCMTest::test_auto_subfolder conans/test/functional/old/scm_test.py::GitSCMTest::test_delegated_python_code conans/test/functional/old/scm_test.py::GitSCMTest::test_deleted_source_folder conans/test/functional/old/scm_test.py::GitSCMTest::test_excluded_repo_fies conans/test/functional/old/scm_test.py::GitSCMTest::test_install_checked_out conans/test/functional/old/scm_test.py::GitSCMTest::test_local_source conans/test/functional/old/scm_test.py::GitSCMTest::test_local_source_subfolder conans/test/functional/old/scm_test.py::GitSCMTest::test_repeat_clone_changing_subfolder conans/test/functional/old/scm_test.py::GitSCMTest::test_scm_bad_filename conans/test/functional/old/scm_test.py::GitSCMTest::test_source_method_export_sources_and_scm_mixed conans/test/functional/old/scm_test.py::GitSCMTest::test_source_removed_in_local_cache conans/test/functional/old/scm_test.py::GitSCMTest::test_submodule conans/test/functional/old/scm_test.py::SVNSCMTest::test_auto_conanfile_no_root conans/test/functional/old/scm_test.py::SVNSCMTest::test_auto_subfolder conans/test/functional/old/scm_test.py::SVNSCMTest::test_auto_svn conans/test/functional/old/scm_test.py::SVNSCMTest::test_excluded_repo_fies conans/test/functional/old/scm_test.py::SVNSCMTest::test_install_checked_out conans/test/functional/old/scm_test.py::SVNSCMTest::test_local_source conans/test/functional/old/scm_test.py::SVNSCMTest::test_local_source_subfolder conans/test/functional/old/scm_test.py::SVNSCMTest::test_repeat_clone_changing_subfolder conans/test/functional/old/scm_test.py::SVNSCMTest::test_source_method_export_sources_and_scm_mixed conans/test/functional/old/scm_test.py::SVNSCMTest::test_source_removed_in_local_cache
conans/test/functional/old/scm_test.py::GitSCMTest::test_scm_other_type_ignored conans/test/functional/old/scm_test.py::SVNSCMTest::test_auto_filesystem_remote_svn conans/test/functional/old/scm_test.py::SVNSCMTest::test_deleted_source_folder conans/test/functional/old/scm_test.py::SVNSCMTest::test_scm_other_type_ignored conans/test/functional/old/scm_test.py::SVNSCMTest::test_scm_serialization conans/test/functional/old/scm_test.py::SVNSCMTest::test_submodule
conans/client/cmd/export.py
conans/client/cmd/export.py